Friday, September 26, 2014

Fish gravity

Axel and Steven spent the morning trying to freshen up their memory on trajectory calculation. We had to calculate when the fish animation was supposed to start, since we need to have the fish at its maximum position when it is at the frog's position, that is, we need to have the fish at max when the frog has jumped and is right above it (if the frog has the appropriate power).

So the things we needed to calculate was the Y max position of the fish, given a certain initial velocity and the time it will take for the fish to reach this maximum.

Maths and stuff

 We used a combination of Wolfram Alpha and our own old physics notes to get the formulas.


Since our game is a never-ending runner type of game, we need to have continuous obstacles spawn for the frog to jump over. But since we ever only show one the fish at the time, we actually only need 2 instances of our Fish class object, once one of them go out of frame to the left, we move it to the right of the other fish instance, which is by then just out of frame to the right side of the screen.
Axel spent the afternoon implementing this.
Fish jumping out of water (the grey rectangle is a placeholder for the fish).

Steven spent the afternoon implementing the formulas from the morning. He'll make a separate blog post on that adventure.