Looks like you are using a dynamic physics sprite (SetSpritePhysicsOn(spr4,
2)) which is affected by gravity. I have changed this to a kinematic sprite (SetSpritePhysicsOn(spr4,
3)) and increased the maximum velocity.
Velocity# = 0
SetDisplayAspect( 4.0/3.0 )
SetClearcolor (255, 255, 255)
AddVirtualButton (1, 90, 90, 8)
rem Create Sprite
spr = CreateSprite (0)
SetSpriteSize ( spr, 20, 5 )
SetSpriteOffset ( spr, 10, GetSpriteHeight (spr)/2)
SetSpritePositionByOffset ( spr, 20, 80)
SetSpriteColor (spr, 255,0,255,255)
rem Create ball Sprite
img4 = LoadImage ("ball.png")
spr4 = CreateSprite (img4)
SetSpriteSize (spr4, 8, -1)
SetSpriteOffset (spr4, 4, GetSpriteY(spr4)/2)
SetSpritePositionByOffset (spr4, 30, 70)
SetSpriteColor (spr4, 255,0,0,255)
do
if GetVirtualButtonState( 1 ) = 1
Velocity# = Velocity# + 5
if Velocity# > 1500 then Velocity# = 1500
angle# = GetSpriteAngle (spr)
vx# = Velocity# * Cos (angle#)
vy# = Velocity# * Sin (angle#)
else
if GetVirtualButtonState( 1 ) = 0
SetSpritePhysicsOn(spr4, 3)
SetSpritePhysicsVelocity(spr4, vx#, vy#)
endif
endif
sync()
loop
oct(31) = dec(25)