Maths does my head in, but this is closest Ill ever get to what your aiming for
// Project: Curve2
// Created: 2017-02-25
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Curve2" )
SetWindowSize( 1024, 768, 0 )
global width=1024
global height=768
// set display properties
SetVirtualResolution( width, height )
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
type _player
x#, y# as float
endtype
global player as _player[2]
player[1].x#=70
player[1].y#=500
player[2].x#=800
player[2].y#=500
x# as float
y# as float
speed# as float
angle# as float
xSpeed# as float
ySpeed# as float
accel# = .90
angle# = 180
speed# = 20
xSpeed# = speed# * cos(angle#)
ySpeed# = speed# * sin(angle#)
x#= player[1].x#
y#= player[1].y#
ball=MakeColor(255,255,255)
player1=makecolor(255,0,0)
player2=makecolor(0,255,0)
playerflip=1
do
inc x#, xSpeed#
inc ySpeed# , accel#
inc y# , ySpeed#
DrawEllipse(player[1].x#, player[1].y#, 10,10,player1,player1,1)
DrawEllipse(player[2].x#, player[2].y#, 10,10,player2,player2,1)
drawellipse(x#, y#, 5, 5, ball,ball,1)
if y#>height
if playerflip=1 then angle# = -random(45,90)
if playerflip=2 then angle# = random(180,270)
speed# = random(20,30)
xSpeed# = speed# * cos(angle#)
ySpeed# = speed# * sin(angle#)
x#=player[playerflip].x#
y#=player[playerflip].y#
inc playerflip
if playerflip>2 then playerflip=1
endif
Print( ScreenFPS() )
Sync()
loop
Damo