In your Spawn routine you can use the variable in the FOR..Next statement instead of current_enemy.
for i = 1 to 10
sprite i,x,y,5
next i
At the end of that loop, the variable i will be 10 thus going from 1 to 10. You can then simply current_enemy = i.
While setting a random value for the Y, it will assign Y a random value only one time. So if you create 10 enemies after Y=RND(x) then all the enemies will have the same Y. You must put Y inside the For..Next loop to assign a new random Y for each enemy.
for i = 1 to 10
X = 600
Y = RND(480)
sprite i,x,y,5
next i
The default display mode will be set to 640x480 16bit if you dont manually set it yourself. Your previous value of Y=RND(600) X=700 was too high.
While moving the sprites you can use the same For..Next as when you spawn them.
FOR i = 1 to 10
If SPRITE EXIST(i)
SPRITE i,SPRITE X(i)-enemy_speed,Sprite Y(i),5
ENDIF
NEXT i
You do not need to reset a variable befor using it in a For..Next. That statement will set and change the variable.
To have your Grand2 have the same x,y position as the mouse it's easier to do it this way.
mx = mousex()
my = mousey()
mc = mouseclick()
sprite 19,mx,my,1
Note that you can also use the mouse functions directly:
mc = mouseclick()
sprite 19,mousex(),mousey(),1
To sync properly make sure you have this at or near the top of the page:
Then in your main loop have it right befor you loop. You may also want a cls at the very end or very beginning.
Do
cls <-- can go here
`**Code Stuff**
`**Code Stuff**
sync
cls <-- or go here
Loop
Lastly you might want to go here. Could save you alot of time and headaches.
http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10