/// @description 

with(instance_create_layer(x, y, "Enemies", obj_entity)) {
	sc_enemy_set(other.enemy_id);
	x = sc_snap_grid(x, BLOCK_WIDTH) + BLOCK_WIDTH/2;
	y = sc_snap_grid(y, BLOCK_HEIGHT) + BLOCK_HEIGHT/2;
}

enemy_spawned++;
enemy_count--;
if (enemy_count <= 0) {
	enemy++;
	if (enemy >= ds_grid_height(global.level_data)) {
		victory = true;
		ds_grid_clear(global.level_data, 0);
		exit;
	}
	enemy_id = sc_enemy_get_id(global.level_data[# LEVEL_WAVE.NAME, enemy]);
	enemy_count = global.level_data[# LEVEL_WAVE.COUNT, enemy];
	
	alarm[0] = global.level_data[# LEVEL_WAVE.DELAY, enemy]+100;
}
else {
	alarm[0] = global.level_data[# LEVEL_WAVE.DELAY, enemy];
}