I tried to set up a simple test, to try applying angle to vector, sort of. And to see if I could help BraindeaD figure out what to do.
And found that I cannot make the sprite move at all! The same basic code works fine in the game I'm doing, but this simple snippet won't work!
// turn gravity off
// turn gravity off
SetPhysicsGravity(0.0,0.0)
// set to base
SetViewOffset(0.0,0.0)
// set a virtual resolution of
SetVirtualResolution(480, 480)
// create a sprite
img = loadimage("player.png")
obj = createsprite(img)
setspritepositionbyoffset(obj,240,240)
SetSpritePhysicsOn(obj,1)
do
fX# = getSpriteXbyOffset(obj)
fY# = getSpriteYbyOffset(obj)
xd# = GetDirectionX()
yd# = GetDirectionY()
s# = GetDirectionSpeed() * 10000.0
vx# = xd# * s#
vy# = yd# * s#
// update sprite angle
ang# = GetSpriteAngle(obj)
// avx# = cos(ang#)*2000
// avy# = sin(ang#)*2000
nang# = ang# + 2.0
if nang# > 360.0 then nang# = 0.0
SetSpriteAngle(obj,nang#)
// none of these work to move the sprite
SetSpritePhysicsVelocity(obj,vx#*10.0,vy#*10.0)
// SetSpritePhysicsImpulse(obj,fX#,fY#,vx#,vy#)
// SetSpritePhysicsForce(obj,fX#,fY#,vx#,vy#)
print("fX#="+str(fX#,2)+" fY#="+str(fY#,2))
print("s#="+str(s#,2)+" xd#="+str(xd#,2)+" yd#="+str(yd#,2))
print("vx#="+str(vx#,2)+" vy#="+str(vy#,2))
Sync()
loop
Cheers,
Ancient Lady