Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.46 KB | None | 0 0
  1. -- Setup
  2. local pnpc = API.load("pnpc")
  3. local particles = API.load("particles")
  4. local colliders = API.load("colliders")
  5.  
  6. local galbos = {}
  7. local galboGraphic = Graphics.loadImage("galbo.png")
  8. local galboFire = {}
  9. local galboFireGraphic = Graphics.loadImage("galbo_fire.png")
  10.  
  11. function onTick()
  12.  
  13.     for _,v in ipairs(NPC.get(132,-1)) do
  14.         if string.find(v.msg.str, "galbo") ~= nil then
  15.             local entry = {}
  16.             entry.x = v.x;
  17.             entry.y = v.y-4;
  18.             entry.direction = v.direction;
  19.             entry.frame = 0;
  20.             entry.timer = 0;
  21.             entry.tick = 0;
  22.             table.insert(galbos,entry)
  23.             v:kill(9)
  24.         end
  25.     end
  26.    
  27.     for k,v in ipairs(galbos) do
  28.         if returnOnscreen(v.x,v.y) == true then
  29.             local hurtCollider = colliders.Box(v.x,v.y,44,36)
  30.             if colliders.collide(player,hurtCollider) then
  31.                 player:harm()
  32.             end
  33.             if colliders.slash(player,hurtCollider) or colliders.downSlash(player,hurtCollider) or colliders.bounce(player,hurtCollider) then
  34.                 playSFX(53)
  35.                 Animation.spawn(63,v.x,v.y)
  36.                 if colliders.downSlash(player,hurtCollider) or colliders.bounce(player,hurtCollider) then
  37.                     colliders.bounceResponse(player)
  38.                 end
  39.                 table.remove(galbos,k)
  40.             end
  41.        
  42.             v.timer = v.timer + 1;
  43.             v.tick = v.tick + 1;
  44.        
  45.             if v.timer < 100 then
  46.                 if v.tick >= 6 then
  47.                     if v.frame > 3 then
  48.                         v.frame = 0;
  49.                     end
  50.                     v.frame = v.frame + 1;
  51.                     v.tick = 0
  52.                 end
  53.             elseif v.timer == 100 then
  54.                 v.frame = 4;
  55.             elseif v.timer == 110 then
  56.                 v.frame = 5;
  57.                 playSFX(16)
  58.                 for i=1,3 do
  59.                     local entry = {}
  60.                     entry.x = v.x;
  61.                     entry.y = v.y;
  62.                     entry.tick = 0;
  63.                     entry.frame = 0;
  64.                     if i == 1 then
  65.                         entry.speedX = 8 * v.direction;
  66.                         entry.speedY = 0
  67.                     elseif i == 2 then
  68.                         entry.speedX = 6 * v.direction;
  69.                         entry.speedY = -3
  70.                     elseif i == 3 then
  71.                         entry.speedX = 6 * v.direction;
  72.                         entry.speedY = 3
  73.                     end
  74.                     table.insert(galboFire,entry)
  75.                 end
  76.             elseif v.timer == 130 then
  77.                 v.timer = 0;
  78.                 v.frame = 0;
  79.             end
  80.         end
  81.     end
  82.    
  83.     for k,v in ipairs(galboFire) do
  84.         v.x = v.x + v.speedX;
  85.         v.y = v.y + v.speedY;
  86.        
  87.         local butts = colliders.Box(v.x,v.y,32,12)
  88.         if colliders.collide(player,butts) then
  89.             player:harm()
  90.         end
  91.        
  92.         if (v.x < useCamera.x) or (v.x > useCamera.x+800) then
  93.             table.remove(galboFire,k)
  94.         end
  95.        
  96.         v.tick = v.tick + 1;
  97.        
  98.         if v.tick >= 4 then
  99.             v.tick = 0;
  100.             if v.frame == 0 then
  101.                 v.frame = 1;
  102.             else
  103.                 v.frame = 0;
  104.             end
  105.         end
  106.     end
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement