// minigame. spawn 5 enemies public static void miniGame() { wave wave = levels[counter]; // spawn num ammount of enemies with properties stored in w test(wave); }
// loop enemy spawn public static void test(wave wave) { left = wave.num; for (int i = 0; i < wave.num; i++) { spawn(wave); } }
// spawn a single enemy based on wave properties public static void spawn(wave wave) { // values string type = wave.type; int damage = wave.damage; int AS = wave.attackSpeed; int hp = wave.hp; int limit_x = SBGame.getMap().Size_x - 5; int limit_y = SBGame.getMap().Size_y - 5; int x = generator.Next(10, limit_x); int y = generator.Next(0, limit_y); Unit u = new Unit(x, y, 50, false, type, hp); Weapon.loadUnit(u, damage, AS, false, wave.type); }