Here you go.
It's very
rough and ready and you could do a lot to improve it but it is a workable "proof of concept"
No media required. Just click on the red 'ball' and drag it. Then release to launch it.
SetWindowSize(800, 800,0)
SetVirtualResolution(800, 800)
launchX = 400
launchY = 700
bandForce = 10
ball = CreateSprite(0)
postLeft = Createsprite(0)
postRight = CreateSprite(0)
SetSpriteColor(ball, 255, 0, 0, 255)
SetSpriteColor(postleft, 255 ,255, 0, 255)
SetSpriteColor(postright, 255 ,255, 0, 255)
SetSpriteSize(ball, 20, 20)
SetSpriteSize(postleft, 5, 5)
SetSpriteSize(postright, 5, 5)
SetSpritePosition(postleft, 350, 700)
SetSpritePosition(postright, 450, 700)
SetSpritePosition(ball, 400, 700)
held = 0
flying = 0
launching = 0
do
px = GetPointerX()
py = GetPointerY()
if GetPointerPressed()
if GetSpriteHitTest(ball, px, py)
held = 1
endif
endif
if GetPointerState()
if held
if GetSpriteY(ball) < GetSpriteY(postleft)
held = 0
SetSpritePosition(ball, launchX, launchY)
else
SetSpritePosition(ball, px, py)
endif
endif
endif
if not(GetPointerState())
if held
held = 0
launching = 1
SetSpritePhysicsOn(ball, 2)
SetSpritePhysicsVelocity(ball, (launchX - GetSpriteX(ball)) * bandForce, (launchY - GetSpriteY(ball))*bandforce)
endif
endif
if launching
if GetSpriteY(ball) < launchY
launching = 0
flying = 1
endif
endif
if flying
if GetSpriteY(ball) > 770
flying = 0
SetSpritePosition(ball, launchX, launchY)
SetSpritePhysicsOff(ball)
endif
DrawLine(GetSpriteX(postleft), GetSpriteY(postleft), GetSpriteX(postright), GetSpriteY(postright), 0xFFFFFF, 0xFFFFFF)
else
DrawLine(GetSpriteX(postleft), GetSpriteY(postleft), GetSpriteX(ball), GetSpriteY(ball) + GetSpriteHeight(ball), 0xFFFFFF, 0xFFFFFF)
DrawLine(GetSpriteX(ball), GetSpriteY(ball) + GetSpriteHeight(ball), GetSpriteX(ball) + GetSpriteWidth(ball), GetSpriteY(ball) + GetSpriteHeight(ball), 0xFFFFFF, 0xFFFFFF)
DrawLine(GetSpriteX(postright), GetSpriteY(postright), GetSpriteX(ball) + GetSpriteWidth(ball), GetSpriteY(ball) + GetSpriteHeight(ball), 0xFFFFFF, 0xFFFFFF)
endif
sync()
loop