diff options
| -rw-r--r-- | particles.lua | 27 | ||||
| -rw-r--r-- | players.lua | 8 |
2 files changed, 14 insertions, 21 deletions
diff --git a/particles.lua b/particles.lua index eec59b3..f26718f 100644 --- a/particles.lua +++ b/particles.lua @@ -1,27 +1,20 @@ shake = 0 function addcircle(x, y, velx, vely, r, time, color, grav) local circle = { - x = x, - y = y, - velx = velx, - vely = vely, - r = r, - time = time, t = time, - col = color, - grav = grav or 0 } + grav = grav or 0 function circle.draw() - circfill(circle.x, circle.y, circle.r*sin(circle.time/circle.t), circle.col) + circfill(x, y, r*sin(time/circle.t), color) end - function circle.update(cirle) - circle.x += circle.velx - circle.vely -= circle.grav - circle.y += circle.vely - circle.time -= ft - if circle.time < 0 then + function circle.update() + x += velx + vely -= grav + y += vely + time -= ft + if time < 0 then del(obj, circle) end end @@ -42,7 +35,7 @@ end function damagesmoke(object) --smokes when damaged! - if rnd() < 0.4 then - addcircle(object.x+rnd(object.w*0.5), object.y+rnd(object.w*0.5), -0.5, -0.2, rnd(6), rnd(1.5)+1, rnd({5,5,9})) + if rnd() < 0.2 then + addcircle(object.x+rnd(object.w*0.5), object.y+rnd(object.w*0.5), -0.5, -0.2, rnd(7), rnd(1.2)+1, rnd({5,5,9})) end end
\ No newline at end of file diff --git a/players.lua b/players.lua index a6a7dc5..d87340c 100644 --- a/players.lua +++ b/players.lua @@ -99,14 +99,14 @@ function addplayer(x, y, sprite, bulletsprite) end -- addcircle(player.x-1, player.y, -0.5, 0, 1.5, 0.5, 9) -- addcircle(player.x-1, player.y+7, -0.5, 0, 1.5, 0.5, 9) - if player.health < 3 then + if player.health < 3 then --sparks addcircle(player.x+rnd(8), player.y+rnd(8), rnd(1.5)-0.75, -1.5, 1, rnd(1)+0.5, rnd({9,10}), -0.1) - if player.health < 2 then - damagesmoke(player) - end end player.particlecooldown = 0.1 end + if player.health < 2 then + damagesmoke(player) + end --shooting after cooldown player.shootcooldown -= ft |
