The Daily Click ::. Forums ::. Klik Coding Help ::. 360 Movement
 

Post Reply  Post Oekaki 
 

Posted By Message

Aptennap



Registered
  23/04/2004
Points
  916
18th January, 2008 at 10:31:09 -

I need a topdown 360 movement similar to gta 1 and 2. I tryed this :
+Right arrow pressed
-set angle of player to angle(player)+5

+Left arrow pressed
-set angle of player to angle(player)-5

+Up arrow pressed
-set x-pos of player to x(player)+XMovement( "Advanced Direction Object", Angle( "player" ), 2)
-set y-pos of player to y(player)+YMovement( "Advanced Direction Object", Angle( "player" ), 2)

+Down arrow pressed
-set x-pos of player to x(player)-XMovement( "Advanced Direction Object", Angle( "player" ), 2)
-set y-pos of player to y(player)-YMovement( "Advanced Direction Object", Angle( "player" ), 2)

But it isnt working properly the player moves in the same direction at different angles sometimes, and moves at different speeds in different directions .


 
Oh sweet mary.

Ganymede Graphics

Possibly Insane

Registered
  17/04/2006
Points
  2711

GOTW JANUARY 2011
21st January, 2008 at 22:56:39 -

+right arrow pressed
-set anglevalue to angle value - 5

+left arrow pressed
-set anglevalue to angle value + 5

+up arrow pressed
-set speedvalue to speed value + 1

+always
-set xvalue to xvalue + speedvalue * cos(anglevalue)
-set yvalue to yvalue + speedvalue * sin(anglevalue) * -1
-set x position to xvalue
-set y position to yvalue

----------------------------------------------

this should get your car going no problem. 360 degree stuff is a little more complicated than you think, sadly this stuff involves trigonometry. you'll get it! if you find any problems with the code i gave you, heres a link to an example. have fun!

http://www.create-games.com/download.asp?id=6565



 
Especially that.

Aptennap



Registered
  23/04/2004
Points
  916
22nd January, 2008 at 00:16:17 -

Oke thanks

 
Oh sweet mary.

Ganymede Graphics

Possibly Insane

Registered
  17/04/2006
Points
  2711

GOTW JANUARY 2011
22nd January, 2008 at 08:19:29 -



 
Especially that.
   

Post Reply



 



Advertisement

Worth A Click