19
« on: January 22, 2014, 03:55:43 PM »
So I had some special requirements for this, because it was being used for my game MicRogue. I wanted it so Enemies were never removed from the spawn list, so there was always a chance to spawn, but also that there needed to be a good variety of enemies in a level, because the game is very boring when all the enemies are the same. I ended up just going with a simple switch and an enemy array. Its probably not the most elegant way, but its easy to change and add monsters and it was quick to code.
// Create the Monster Array
var Monster_Array:Array = []
// 1 = Slime
// 2 = Large Fire
// 3 = Skeleton Warrior
// 4 = Demon
// 5 = Eye
// 6 = Ninja
// 7 = Cockatrice
switch (Floor)
{
case 1: { Monster_Array = [1, 1, 1, 2, 5] }; break;
case 2: { Monster_Array = [1, 1, 1, 2, 5] }; break;
case 3: { Monster_Array = [1, 1, 1, 2, 2, 3, 4, 5] }; break;
case 4: { Monster_Array = [1, 1, 2, 2, 3, 4, 5, 5, 6] }; break;
case 5: { Monster_Array = [1, 1, 2, 2, 3, 4, 5, 5, 6, 7] }; break;
case 6: { Monster_Array = [1, 1, 2, 2, 2, 3, 4, 5, 5, 6, 7] }; break;
case 7: { Monster_Array = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7] }; break;
case 8: { Monster_Array = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] }; break;
case 9: { Monster_Array = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] }; break;
case 10: { Monster_Array = [1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] }; break;
}