Showing posts with label Week 6. Show all posts
Showing posts with label Week 6. Show all posts

Friday, October 10, 2014

Fish jump calculations and fly speeds

Fixed some problems with fish jump calculations. First of all, out time calculation was off. We switched to the time calculation described on this site: http://www.wired.com/2008/12/what-angle-should-you-throw-a-football-for-maximum-range/
Secondly, we were using the wrong velocity when calculating the fish Y max value. We were using only the y component of our initial velocity vector when the formula says to use the whole velocity vector. These two changes made the jump calculation much more precise.
After that I focused on making sure the fly reaches the frog at the same time as the fish does. Since the fly is supposed to be reset just as the three objects collide, it is reset before the fish is, which leads to the fly getting more and more offset each reset. 

 
Fish jump calculations

Transitions, new fly, water lilies


We managed to do some progress today with the water, water lilies, background transition, menu buttons and the fly. The transition between the lilies and the mountain was needed because there is a big gap in terms of sizes, so we created a transition with hills and larger rocks that would lessen the difference.



The fly was replaced by new graphics that is viewed from the side rather than the top of the fly because flies are usually flying sideways :)

For the water lilies we decided to make single images of each lily which we then can randomize in the game in order to avoid that the lilies look the same all the time. Furthermore, we also changed the color of the water to a lighter, more turquoise tone instead of dark blue. This made it look more realistic.  


Lastly, all the icons for the buttons we finished. Now we just need to decide the background colors for each button.

Main menu, resolution and multiple device dimensions

So a problem with the main menu was fixed, whereas a translationVector was added to get the correct X, Y position, as the Y axis is reverted. Also a small bug was corrected with the highscore, it would seem that the spritebatch.end() was called inside of a if statement that was not always true, prompting the game to crash.

We hit a major problem today with getting the resolution to work with multiple devices. It would seem that there was some hardcoded settings in the code that made it look great on iPhone and android mobile phones. This is most likely because of the 16:9 ratio that most phones have. When trying the game on an iPad with 4:3 ratio though it made some weird graphical bugs which I though that I fixed with some small adjustments to the gameScreen and gameRenderer classes. Like changing the orthographic camera viewports and calculating a correct gameWidth. But it would seem that it instead made it look very bad and streached on android devices which has a resolution of 1920x1080. This means that we most likely need to change like everything that is hardcoded with pixels in the game. Since we originally had a viewport of 1024x576 we could hardcode objects with pixels have have it appear the same on every screen with a 16:9 resolution. But we need to make all the objects relative to the screen resolution now, and that is a lot of code to redo.

Here are two pictures of what it looks like on iphone and android with the streached version.
Iphone 5s

Samsung Galaxy S4