Hello, I'm currently using impulse to move a sprite around which is working fine for up/down/left and right... However, what I am actually trying to do is move the sprite forward and backwards, using impuse and turning the sprite using SetSpriteAngle... Meaning that the forward impulse should always be applied to the back of the sprite taking into account the current angle, and vice versa for backwards... I think this requies some mental math, but seeing as maths is not my strong point I thought I'd ask for a little help...
If this doesn't make sense, think of Micro-Machines, thats pretty much what I am trying to do...
This is what I have so far...
if GetRawKeyState(38) = 1 // Up
SetSpritePhysicsImpulse(Sphere, 0, 0, 0, -50)
elseif GetRawKeyState(40) = 1 // Down
SetSpritePhysicsImpulse(Sphere, 0, 0, 0, 50)
endif
if GetRawKeyState(37) = 1 // Left
Angle = Angle - 1
elseif GetRawKeyState(39) = 1 // Right
Angle = Angle + 1
endif
SetSpriteAngle(Sphere, Angle)
However, this only moves the sprite up and down... I believe the direction x/y needs to be calculated based on the angle, and thats where I'm stumped... Thanks in advance...