• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

360� movement

 
Tomm Schuman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in the movement in my game.
I want it so that when the left key is pressed the player turns left and when the right key is pressed the player turns right. Then when the up key is pressed the player moves in the direction he's heading and when the down key is pressed the player moves the opposite way.

Here is the you see how the game is now:Game

Is there anyway to make it possible to see the console from a webpage? Because I have some println statements which print out different values from the calculation. It could be easier to see whats wrong if you see them.

Here is the code I use to calculate the x and y cordinates based on the way the player is heading. The problem is somewhere in the if statements because the player will move 90 degrees okay but then the player moves very weird and starts another 90 degree turn. So please could someone help me making this work.

You can download the full source code here



[ March 12, 2005: Message edited by: Tomm Schuman ]

[ March 12, 2005: Message edited by: Tomm Schuman ]
[ March 12, 2005: Message edited by: Tomm Schuman ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a little bit more complicated than normal for this forum. We do have a Game forum, so I am going to move this thread to that forum.

Mark
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are running this as an applet in a browser under Windows, the Java plug-in usually adds an icon to the system tray next to the clock in the lower right corner. You can right click on this and open a console where your output will be displayed.

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic