aspose file tools*
The moose likes Game Development and the fly likes 360� movement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "360� movement" Watch "360� movement" New topic
Author

360� movement

Tomm Schuman
Greenhorn

Joined: Mar 04, 2005
Posts: 11
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

Joined: Feb 05, 2001
Posts: 17259
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
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


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 360� movement