Good afternoon everyone, this is the first time my question is not from the “nothing works” category. I would like to improve my understanding of code optimization, so maybe someone has some tips on how to make this code better ?
function Spawn(self, monsterName)
if monsterName == "ogre" then
factory.create("main#monster_ogre", vmath.vector3(800, 200, 1), nil ,{damage = ogre_stats.damage, speed = ogre_stats.speed, hp = ogre_stats.hp, height = ogre_stats.height, experience = ogre_stats.experience}, nil)
elseif monsterName == "slaad" then
elseif monsterName == "harpy" then
elseif monsterName == "mushroom" then
elseif monsterName == "giant" then
end
function mobSpawn(self, wavePoint)
local monster = {"slaad", "ogre", "harpy", "mushroom", "giant"}
while(wavePoint > 0)
do
if wavePoint >= 5 then
local numMonster = math.random(1, 5)
wavePoint = wavePoint - numMonster
Spawn(self, monster[numMonster])
print(monster[numMonster])
else
local numMonster = math.random(1, wavePoint)
wavePoint = wavePoint - numMonster
print(monster[numMonster])
end
end
end