diff options
-rw-r--r-- | not/Hero.lua | 7 | ||||
-rw-r--r-- | not/Player.lua | 1 | ||||
-rw-r--r-- | not/World.lua | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/not/Hero.lua b/not/Hero.lua index d92d003..014eeb2 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -44,6 +44,7 @@ function Hero:new (name, x, y, world) self.lives = 3 self.inAir = true self.salto = false + self.smoke = false self.isAlive = true self.isWalking = false self.isJumping = false @@ -105,7 +106,8 @@ function Hero:update (dt) end -- Trail spawner - if self.combo > 100 and self.punchCooldown > 0 then + -- TODO: lower the frequency of spawning - currently it is each frame. + if self.smoke and self.inAir then local dx, dy = love.math.random(-5, 5), love.math.random(-5, 5) self:createEffect("trail", dx, dy) end @@ -263,6 +265,9 @@ function Hero:damage (direction) self.combo = math.min(999, self.combo + 10) self.punchCooldown = 0.08 + self.combo*0.0006 self:playSound(2) + if self.combo > 80 then + self.smoke = true + end end -- DIE diff --git a/not/Player.lua b/not/Player.lua index 8e15da0..11461d3 100644 --- a/not/Player.lua +++ b/not/Player.lua @@ -58,6 +58,7 @@ end -- Controller callbacks. function Player:controlpressed (set, action, key) if set ~= self:getControllerSet() then return end + self.smoke = false -- TODO: temporary -- Jumping if action == "jump" then if self.jumpCounter > 0 then diff --git a/not/World.lua b/not/World.lua index c6b74a3..3a5b051 100644 --- a/not/World.lua +++ b/not/World.lua @@ -337,6 +337,7 @@ function World.beginContact (a, b, coll) b:getUserData().inAir = false b:getUserData().jumpCounter = 2 b:getUserData().salto = false + b:getUserData().smoke = false b:getUserData():createEffect("land") end local vx, vy = b:getUserData().body:getLinearVelocity() |