Hello!
I make a tank game and want the tank to move according to its current rotation. I got it working with this code:
if GetRawKeyState(KEY_S) = 1
dec player.x, player.speed * Cos(player.rotation-90)
dec player.y, player.speed * Sin(player.rotation-90)
elseif GetRawKeyState(KEY_W) = 1
inc player.x, player.speed * Cos(player.rotation-90)
inc player.y, player.speed * Sin(player.rotation-90)
endif
The question is, why i need to subtract 90 from the rotation?
Normally the formula is:
x += speed * Cos(angle)
y += speed * Sin(angle)
Is there a bug in AGKs Sin and/or Cos functions?
AGK2 Tier 1 / GameGuru / DB PRO / ProMotion 6.5