M
Magic-4e
Guest
Hi I have a little game here with a level system where you level up by shooting enemies and with each level the enemies spawn faster and the max enemies becomes more.
But at level 6 the enemies stop spawning for some reason.
I hope someone can tell me how to fix this.
The object I use to level up is the enemy spawner and this is what it contains:
Code of Execute code function:
Code of Execute code function:
The enemies countain a global create variable that sets global.EnemyC relative to 1
The also contain a the global code to set global.Enemy Kill relative to 1 when they get destroyed.
The oject info is:
If you need more info than let me know.
But at level 6 the enemies stop spawning for some reason.
I hope someone can tell me how to fix this.
The object I use to level up is the enemy spawner and this is what it contains:
Code of Execute code function:
Code:
Create = Enemy_multiply;
while (Create > 0)
{
instance_create(x, y, Enemy_obj);
Create --;
}
Code of Execute code function:
Code:
Max_enemys = 1 + global.Level;
The enemies countain a global create variable that sets global.EnemyC relative to 1
The also contain a the global code to set global.Enemy Kill relative to 1 when they get destroyed.
The oject info is:
Code:
Information about object: Enemy_spawner_obj
Sprite: Enemy_spawner_spr
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable global.EnemyC to 0
set variable Time to 60
set variable Spawn to 0
set variable global.Level to 0
set variable global.Enemy_kill to 0
set variable Enemy_multiply to 0
set Alarm 0 to 0
Alarm Event for alarm 0:
if Time is greater than 1
set variable Spawn to 0
Step Event:
if global.Game_End is equal to 0
if global.EnemyC is less than Max_enemys
if Spawn is equal to 0
create instance of object Enemy_obj at relative position (0,0)
if Time is greater than 1
set Alarm 0 to Time
set variable Spawn to 1
else
set variable Time to 1
if Time is equal to 1
set variable Enemy_multiply relative to 1
execute code:
Create = Enemy_multiply;
while (Create > 0)
{
instance_create(x, y, Enemy_obj);
Create --;
}
set variable Spawn to 1
Begin Step Event:
execute code:
Max_enemys = 1 + global.Level;
End Step Event:
if global.Enemy_kill is greater than 4
set variable global.Level relative to 1
set variable global.Enemy_kill to 0
set variable Time relative to -10
Last edited by a moderator: