movement / sprite rotation

Previous topic - Next topic

MrPlow

Hi

I have a rotating sprite and want to move it forward in the direction relative to the rotation of the sprite

So if it is pointing downleft have the acceleration begin from there...

Also want to accelerate the sprite slowly.

Is there an easy way to do this without mind-numbing math?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Okay I think I have the movement sorted...

Just need a acceleration method...

Code (glbasic) Select
myship.x =myship.x - (COS(myship.ang) * 2)
myship.y = myship.y + (SIN(myship.ang) * 2)


Where ang = rotosprite value...
:good:
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

kanonet

Yeah thats the way to do it. in this calculation '2' is the speed of the spritemovement, if you want to move your sprite faster, just replace the '2' with your speed.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

MrPlow

I managed to get a nice acceleration routine done...thnks!!!

Speeds up and slows down gradually...wow - eureka moment!  :booze:
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

matchy

Code (glbasic) Select

DEC myship.x, COS(myship.angle) * myship.speed
INC myship.y, SIN(myship.angle) * myship.speed