is there any good formula's for 2d java game - to make ur player move right or left?
when user hit right key, walk_right get to set to true and when user left go of right key, walk_right get set to false.
i have really basic code to make my player move right or left.
i was wondering if there are any good physics formulas, to move right or left. and i dont mean jump. just right or left.
Code :
while(true){
if(walk_right == true){
x += dx;
}
else if(walk_right == false){
}
if(walk_left == true) {
x -= dx;
}
else{
}
}
Re: is there any good formula's for 2d java game - to make ur player move right or le
I see many posts on the forum related to movement in this 2D game. I think part of the problem is in code not yet shown.
Post the code that shows the event handlers for the key listener. Also post any other code related to movement of the player.