In the type "emen", i want to store the following variables. That works fine. My problem is setting up an array of type enem so i can cycle through them all in a loop, checking where each enemy on the screen is.
TYPE enem
cur_x_pos
cur_y_pos
orig_x_pos
hp
sprite_num
ENDTYPE
This works for one enemy, but it doesnt help me much:
GLOBAL enemy_array AS enem
I tried:
DIM enemy_array[max_enemies] AS enem
where as max emenies is a variable that contains the max amount of enemies that might be on the screen.
I want an array that is the size of max_enemies, that is of the type enem. how do i do that?
hehe
GLOBAL enemy_array[] AS enem
DIM enemy_array[max_enemies]
BTW: instead of DIM... try that:
LOCAL e AS enem
e.x = 100
...
DIMPUSH enemy_array[], e
Isn't the name of the type supposed to be big letters?
TYPE ENEM
LOCAL e AS ENEM
Quote from: GernotFrischhehe
GLOBAL enemy_array[] AS enem
DIM enemy_array[max_enemies]
BTW: instead of DIM... try that:
LOCAL e AS enem
e.x = 100
...
DIMPUSH enemy_array[], e
can't thank you enough. i had a deadline for my code today, so right now all the data is stored in a two dimensional array, and it isn't exactly the easiest thing to read.
i'm going to change the code to have the dimpush for the enemies, and i'm going to use the first answer to my question for the bullets that are fired from all the ships. i'll be sure to post back if i have any more questions.
thanks again!