Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup
- local pnpc = API.load("pnpc")
- local particles = API.load("particles")
- local colliders = API.load("colliders")
- local galbos = {}
- local galboGraphic = Graphics.loadImage("galbo.png")
- local galboFire = {}
- local galboFireGraphic = Graphics.loadImage("galbo_fire.png")
- function onTick()
- for _,v in ipairs(NPC.get(132,-1)) do
- if string.find(v.msg.str, "galbo") ~= nil then
- local entry = {}
- entry.x = v.x;
- entry.y = v.y-4;
- entry.direction = v.direction;
- entry.frame = 0;
- entry.timer = 0;
- entry.tick = 0;
- table.insert(galbos,entry)
- v:kill(9)
- end
- end
- for k,v in ipairs(galbos) do
- if returnOnscreen(v.x,v.y) == true then
- local hurtCollider = colliders.Box(v.x,v.y,44,36)
- if colliders.collide(player,hurtCollider) then
- player:harm()
- end
- if colliders.slash(player,hurtCollider) or colliders.downSlash(player,hurtCollider) or colliders.bounce(player,hurtCollider) then
- playSFX(53)
- Animation.spawn(63,v.x,v.y)
- if colliders.downSlash(player,hurtCollider) or colliders.bounce(player,hurtCollider) then
- colliders.bounceResponse(player)
- end
- table.remove(galbos,k)
- end
- v.timer = v.timer + 1;
- v.tick = v.tick + 1;
- if v.timer < 100 then
- if v.tick >= 6 then
- if v.frame > 3 then
- v.frame = 0;
- end
- v.frame = v.frame + 1;
- v.tick = 0
- end
- elseif v.timer == 100 then
- v.frame = 4;
- elseif v.timer == 110 then
- v.frame = 5;
- playSFX(16)
- for i=1,3 do
- local entry = {}
- entry.x = v.x;
- entry.y = v.y;
- entry.tick = 0;
- entry.frame = 0;
- if i == 1 then
- entry.speedX = 8 * v.direction;
- entry.speedY = 0
- elseif i == 2 then
- entry.speedX = 6 * v.direction;
- entry.speedY = -3
- elseif i == 3 then
- entry.speedX = 6 * v.direction;
- entry.speedY = 3
- end
- table.insert(galboFire,entry)
- end
- elseif v.timer == 130 then
- v.timer = 0;
- v.frame = 0;
- end
- end
- end
- for k,v in ipairs(galboFire) do
- v.x = v.x + v.speedX;
- v.y = v.y + v.speedY;
- local butts = colliders.Box(v.x,v.y,32,12)
- if colliders.collide(player,butts) then
- player:harm()
- end
- if (v.x < useCamera.x) or (v.x > useCamera.x+800) then
- table.remove(galboFire,k)
- end
- v.tick = v.tick + 1;
- if v.tick >= 4 then
- v.tick = 0;
- if v.frame == 0 then
- v.frame = 1;
- else
- v.frame = 0;
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement