Here is my working solution for jumping and moving my sprite. Instead of having SetSpritePhysicsVelocity ( 2, 500, 0 ) running in my game loop to move my sprite. Instead I removed the velocity and just update my sprites x position if Jump = 0 which you can see in the code.
if ( GetPointerPressed ( ) = 1 )
Jump = 1
endif
If (GetPointerPressed ( ) = 0 )
Jump = 0
endif
If Jump = 1
score = score +5
// find player location
x# = getspritex(2)
y# = getspritey (2)
SetSpritePosition ( 2, x#, y#-200 )
endif
If Jump = 0
x# = getspritex(2)
y# = getspritey (2)
Setspriteposition ( 2, x#+8, y#+3.8 )
endif
for i = 1 TO 200
If GetSpriteCollision ( Object[i], 2 ) =1
Print (" Game Over")
endif
next i
Working
If Jump = 0
x# = getspritex(2)
y# = getspritey (2)
Setspriteposition ( 2, x#+8, y#+3.8 )
endif
Not Working
If Jump = 0
x# = getspritex(2)
y# = getspritey (2)
Setspriteposition ( 2, x#, y#+3.8 )
endif
SetSpritePhysicsVelocity ( 2, 500, 0 )
I don't know why
SetSpritePhysicsVelocity ( 2, 500, 0 ) running in game loop would mess with the collision detection from the side of my box sprites when the top side would be detected. If someone could jump in and explain would be a help. Also if your updating the X or Y position rapidly I can either fall through or push through my sprites with physics on.