smallbasic - small basic reset shape position after it got out of the screen -


please help!!!!

i'm having little problem small basic

i wanted make little game ufo has avoid asteroids, , made asteroid , animated it, , wanted make y position go 0 wen passed screen..

meteimg = "c:\users\user\desktop\meteo.png" meteorite = shapes.addimage(meteimg)  meteoritex = math.getrandomnumber(graphicswindow.width) shapes.move(meteorite, meteoritex, 0) shapes.animate(meteorite, meteoritex, graphicswindow.height,math.getrandomnumber(2000)) 

and should add like

if meteorite's y position > graphicswindow.height shapes.move(meteorite, meteoritex, 0) endif 

you shouldn't using shapes.animate this. can't position of object while moving. here code astroids:

numastroids = 10 = 1 numastroids astroid[i] = shapes.addellipse(20,20) astroidx[i] = math.getrandomnumber(graphicswindow.width-20) astroidy[i] = -math.getrandomnumber(graphicswindow.height) astroidspeed[i] = math.getrandomnumber(4) + 1 '<- min speed 1 endfor  while 1 = 1 program.delay(10) = 1 numastroids shapes.move(astroid[i],astroidx[i],astroidy[i]) astroidy[i] = astroidy[i] + astroidspeed[i]  if astroidy[i] > graphicswindow.height   astroidx[i] = math.getrandomnumber(graphicswindow.width-20)   astroidy[i] = -math.getrandomnumber(50)-20   astroidspeed[i] = math.getrandomnumber(4) + 1 '<- min speed 1  endif endfor endwhile 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -