Hey everyone!
I've been trying to make my enemies bounce while moving forward towards the player. This means moving in both X and Y directions and please note that this is NOT a platform game so there aren't any solid platforms to stand on. It's more of a top-down game and below is my current code:
<img src="http://i.imgur.com/A4KITrJ.png" border="0" />
At the moment I can see this working in one out of two ways:
1.) I use gravity and make the enemy jump up. The problem is that the bounce needs to be stopped where it started (in Y axis) and this is the way i have it now -- a nice bounce in place effect. The problem is that the enemy can't move in the Y axis towards the enemy because this interferes with the bounce. Also the gravity messes things up.
2.) I make an animation that looks like a bounce and then move the enemy towards the player by calculating distance and the amount to move each frame. While doing this i just run the animation over and over. The problem with this is that the animation only can change one pixel per step so it becomes very jerky.
I would prefer to have it bounce "naturally" by utilizing gravity since i believe this would look smoother, but since there are no platforms or solids to bounce on, this has presented a problem for me. Any suggestions would be awesome!