갑툭튀 허공공격 좀비 기본세팅입니다.
일단 설명 한번 들어보시고, 이후에 활용해보세요.
>>game.lua
function Game.Rule:OnUpdate(time)
if List then
for _,v in pairs(List) do
if v.user.Waited == true then
v.user.Function()
else
v.user.Waited = true
--온업데이트 1회만에 Function을 발동시키면 간혹 허공공격을 하지 않을 때가 있어서 첫 1회 때는 Waited == true 체크방식으로 대기 상태로 놔둡니다.
end
end
end
end
List = {}
DecoyBlock = {x=10, y=0, z=1} --예제의 경우 디코이 블럭의 좌표값입니다.
function set1 (onoff)
if onoff == false then return end
Mob = Game.Monster.Create(Game.MONSTERTYPE.NORMAL0, {x=9, y=0, z=1})
--좀비를 스폰시키면 기본적으로 x축 양수 방향을 봅니다. (9,0,1)좌표에 스폰시키면 좀비는 디코이 블록을 보고 있게 됩니다. 어디에 스폰시키느냐에 따라서 공격방향조정이 가능합니다.
table.insert(List, Mob)
Mob.user.ListNumber = #List
Mob.user.Function = function() --인게임 업데이트에서 작동할 함수입니다.
Mob.position= {x=1, y=-3, z=1}
Mob:Stop(true)
table.remove(List, Mob.user.ListNumber)
end
end