Friday, February 5, 2016

Spread Eagles: Eagles on Point

On Wednesday there was a Google Developer Group meetup in Detroit. It was quite interesting and really inspiring. I felt so inspired, I pulled out my laptop and started working on Spread Eagles some more. During my time at the meetup I started to get the eagles to appear on screen. I had them following a path that would go to where you clicked, but for some reason they just kept going to the right, never the left. Turns out it was because I was still using the backdrop level camera as the stage for the eagles. Know what that means? I had to move all of my eagle code into a different class and make my own stage for them. At this point there are three different stages. One that holds the backdrop level, one that holds Ride's sprite, and one for the eagles to fly on. Later after the meetup I successfully got the eagle stage finished and had eagles flying the correct way. It was tedious, but necessary. The next day (yesterday) I tried to get the eagles to check collisions with the backdrop level. This was difficult for me. I was coming up with a rather lengthy algorithm for checking eagle coordinates against level coordinates. Why I didn't think about reprojecting the vector position from the eagle stage and unprojecting it from the level stage beats me, but that was the easiest solution to getting the position of where the eagle landed on the other stage. This was great because it didn't involve a lot of code, but I was still having some issues. First issue was that the level still didn't check the collisions correctly. It turns out that was because the y coordinate for drawing is always going to be upside down of the y coordinate for touch positions. Essentially, I thought I should have been checking for an eagle at 8,3, but really it was at 8,8 (my camera is 11 coordinates high so it was simple math of subtracting the y position from 11). The second problem was that sometimes the eagles were hitting multiple targets. This was because I had thrown a level together willy nilly and wasn't considering how close different hittable tiles were next to each other. After I redid the level a little bit and spread out the hittable tiles, it started to look much smoother. Next I will be building out the level to test how fun/playable it is, and I'll be adjusting speeds of both the camera and the eagles. I should also flip the eagle texture so when it goes left it actually points to the left. Here's a new screenshot:

No comments: