Detecting upwards movement Java

+1 Alex Sweps · September 26, 2014
I am creating an android game and so far I have my player moving around and jumping but I want the player to move across the x access only while he is moving upwards. Is there a quick way to check if the player is moving up? Something like if (y == up) else if(y == down)? 

Any help would be appreciated. 

Post a Reply


Oldest  Newest  Rating
+1 Pere Garau Burguera · September 26, 2014
If you provide us your code so we can see how you did the movement, we may be able to help you and give a more precise solution ;)
0 Alex Sweps · September 27, 2014
Thanks for the reply. As usual as soon as I ask for some help the solution comes to me...

I made it so it it slowly increments the x position only when the energy loss is greater than the y speed. So basically while the player is moving up in a jump it will also go across the x axis and once the energy loss kicks in and pushes the player down it stops moving across.  
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator