This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Sirtuck
Sirtuck presents ...

2011/10/2

Project 1

Up here so I can show someone, feel free to take a look and comment on it.

-----Active-----
'wasd' movement/ mouse
point and click (partly)

2590 views / 2 in the last 7 days

Tags: None

Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Sun Oct 02 02:43:08 UTC 2011
A new version of this scenario was uploaded on Sun Oct 02 02:51:39 UTC 2011
A new version of this scenario was uploaded on Sun Oct 02 04:36:52 UTC 2011
A new version of this scenario was uploaded on Mon Oct 03 17:24:20 UTC 2011
A new version of this scenario was uploaded on Mon Oct 10 01:31:18 UTC 2011 Remade Moving
A new version of this scenario was uploaded on Fri Oct 14 03:24:48 UTC 2011 Selection menu stat menu
MentalBrinkMentalBrink

2013/4/22

Could you please share how the point and click movement works?
SirtuckSirtuck

2013/4/23

Yeah. First off instead of using getX() and getY() I store the x and y values in doubles, this helps maintain accuracy. So once the user clicks I grab the mouseInfo. Using this I get an xDis and yDis. From these I find the angle from the player to the mouse position. Now with the angle I use basic trig to find the x portion of the angle and the y portion of the angle. Using these I multiply them times the speed of my object and add them to the x or y storage values I keep. Then set the location of the object to x, y. That is the basic setup, if you have any other questions or need clarification please let me know.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.