Re: Need help with lua? - LunaLua General Help
Posted: Fri Mar 22, 2019 1:01 am
Simple question for the brightest of you.
I'm trying to make a NPC split into two other NPCs when stomped but I have no idea how. (In this case, a huge goomba turning into SMB3 goombas.)
So far I've made this, but this makes ALL stomped NPCs spawn 2 goombas around ALL big goombas.

I'm trying to make a NPC split into two other NPCs when stomped but I have no idea how. (In this case, a huge goomba turning into SMB3 goombas.)
So far I've made this, but this makes ALL stomped NPCs spawn 2 goombas around ALL big goombas.
Code: Select all
function onNPCKill(eventObj,killedNPC,killReason)
for k,v in pairs(NPC.get(71,player.section)) do
a = NPC.spawn(1,v.x+32,v.y+15,player.section)
b = NPC.spawn(1,v.x-26,v.y+15,player.section)
a.direction = 1
b.direction = 0
a.speedY = -6
b.speedY = -6
end
end
