Quote: "How can I transform it to LOOP type? "
You have the do-loop in there but I assume you mean for-loops?
Anyway, you currently have this:
for i = 1 to 3
create animated sprite i,"GrogMegaSprite.png",10,1,i
next i
which creates 3 sprites 1, 2 and 3. Now the long way to handle each of these sprites is to make variables for each one such as enemy1x, enemy2x etc. What you could do if you plan to use the same concept of variables (e.g have an 'x' and a 'y' for each sprite) for each sprite is to make a user defined type as seen in my first post.
If you wish to collectively handle sprites, you can create an array of your user defined type. Same code as before:
type enemy
x as integer
y as integer
xspeed as integer
yspeed as integer
sprite_num as integer
image_num as integer
health as integer
alive as boolean
endtype
dim enemies(100) as enemy
` do stuff with them (Hint: use for loops)
`display the sprites
do
for n = 1 to 100
sprite enemies(n).sprite_num, enemies(n).x, enemies(n).y, enemies(n).image_num
next n
sync
loop
Ok the first bit is the type endtype declaration. This will create a "type" or DBPro's version of a class (not as powerful as the ones seen in c++, java etc).
The next line creates an array of that class, enemy. So now we have 100 (101 if you count enemies(0), you don't have to) enemies. Each of those 100 enemies now has each of those variables listed in our type enemy. The for-loop I use in the do-loop is just a small example of how you can handle all of those aliens collectively and you don't have to do it individually.
To access each element of the type you follow the main variable (enemies) with a dot (.) and then the element. E.g if I wanted access to the first alien's x value I would access it like this enemies(1).x .
Note, you
cannot have arrays in UDTs
type mytype
dim x(10) as integer ` this will cause an error
endtype
Hopefully I have explained well enough and provided enough information for you to have a go at restructuring your code. If you have any questions just ask
A clever person solves a problem, a wise person avoids it - Albert Einstein