Thanks, that 0.1 did wonders! I even got SetSpritePhysicsForce to work:
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Green Hero Box" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 0 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 800, 600 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
setphysicsscale(0.1)
SetPhysicsGravity(0 , 0)
hero = CreateSprite(0)
SetSpriteSize( hero, 30, 51 )
SetSpriteColor( hero, 0, 255, 128, 255 )
SetSpritePhysicsOn( hero, 2)
SetSpritePhysicsCanRotate( hero, 0 )
SetSpritePhysicsDamping( hero, 7.0)
heroSpeed as Float = 60000.0
SetSpritePosition (hero, GetVirtualWidth()/2, GetVirtualHeight()/2)
do
// W
// A S D
//
// 8 directional navigation here:
if GetRawKeyState(65) // A, possibly in combination with W or S
if GetRawKeyState(87) // W
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),-heroSpeed*0.7,-heroSpeed*0.7)
elseif GetRawKeyState(83) // S
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),-heroSpeed*0.7,heroSpeed*0.7)
else
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),-heroSpeed, 0)
endif
endif
if GetRawKeyState(68) // D, possibly in combination with W or S
if GetRawKeyState(87) // W
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),heroSpeed*0.7,-heroSpeed*0.7)
elseif GetRawKeyState(83) // S
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),heroSpeed*0.7,heroSpeed*0.7)
else
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),heroSpeed,0)
endif
endif
if GetRawKeyState(87) and not GetRawKeyState(65) and not GetRawKeyState(68) // W (A or D not pressed)
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),0,-heroSpeed)
endif
if GetRawKeyState(83) and not GetRawKeyState(65) and not GetRawKeyState(68) // S (A or D not pressed)
SetSpritePhysicsForce(hero,GetSpriteXByOffset(hero),GetSpriteYByOffset(hero),0,heroSpeed)
endif
StepPhysics(1.0/60.0)
Sync()
loop