im trying to drop a ball from 0 (y) at random x using physics
this is actually from the examples , the 4 soccer balls that fall down
i want a new ball to spawn each XXX time so i use a simple timer but for some reason this dosent work , here is the code
again i am new to basic and to GDK so please be patient ,
ty for your time
// getting started with box2d
// set a virtual resolution
SetVirtualResolution ( 320, 480 )
// display a background
CreateSprite ( LoadImage ( "background3.jpg" ) )
// load an image
LoadImage ( 1, "small_ball.png" )
SetRandomSeed(320)
ResetTimer()
time = GetMilliseconds()
sTime = GetMilliseconds()
delay = 2000
ball = 1
// main loop
do
time = GetMilliSeconds()
check = sTime + delay
if (check > time)
CreateSprite (ball,1)
SetSpritePosition(ball,random(0,320),0)
SetSpritePhysicsOn(ball,2)
ball = ball + 1
sTime = time
// update the screen
endif
print(str(check))
Sync ( )
loop