Changing the angle and position of physics objects manually tends to result in strange effects. You'll need to set the spinning sprite as a kinematic object (mode 3) and give it an angular velocity to let the physics system know that it is in fact spinning.
The following code should work
ScreenWidth = 640
ScreenHeight = 960
SetVirtualResolution(ScreenWidth,ScreenHeight)
Type S_Obj //Sprite Object
spr
w
h
X#
Y#
EndType
//Create Plank
Plank as S_Obj
Plank.spr = CreateSprite(0)
Plank.w =400
Plank.h =20
SetSpriteSize(Plank.spr, Plank.w,Plank.h)
SetSpritecolor(Plank.spr, 255,0,0,255)
SetSpritePositionbyoffset(Plank.spr,ScreenWidth /2, ScreenHeight/2)
SetSpritePhysicsOn( Plank.spr, 3 )
SetSpritePhysicsAngularVelocity( Plank.spr, 1.5 )
//Create Ball
Cube as S_Obj
Cube.spr = CreateSprite(0)
Cube.w =50
Cube.h =50
SetSpriteSize(Cube.spr, Cube.w,-1)
SetSpritecolor(Cube.spr, 0,255,0,255)
SetSpritePositionbyoffset(Cube.spr,ScreenWidth /2 -Plank.w /3, 0)
SetSpritePhysicsOn( Cube.spr, 2 )
SetSpritePhysicsRestitution(Cube.spr, 0.3)
SetPhysicsGravity (0,0)
SetPrintSize( 40 )
do
If PointerPressed = GetPointerPressed ( )
PX# =GetPointerX()
PY# =GetPointerY()
DX# = GetDirectionX ( ) *10
DY# = GetDirectionY ( ) *10
Cube.x# = getspritexbyoffset(Cube.spr)
Cube.y# = getspriteybyoffset(Cube.spr)
//Move cube sprite via impulse
SetSpritePhysicsImpulse( Cube.spr, Cube.x# +(Dx# *10), Cube.Y# +(Dy# *10) , DX# *100, DY# *100)
EndIf
//keep the plank centered
//SetSpritePositionByOffset(Plank.spr,ScreenWidth /2, ScreenHeight /2)
//SetSpriteAngle( plank.spr, getspriteangle(plank.spr) +2)
Print ("X Velocity = " + str (GetSpritePhysicsVelocityX(Cube.spr)) )
Print ("Y Velocity = " + str (GetSpritePhysicsVelocityY(Cube.spr)) )
Sync()
loop