summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-01-14 21:08:23 +0100
committerAki <nthirtyone@gmail.com>2017-01-14 21:08:23 +0100
commitefe80dc4f1e5c52929717b442e6305731577808c (patch)
tree088b79b759e8fa0ee4f01ea929fc4686d07e0689
parent1f787dd7d68247669ebcdf71b2afab56cb1c3d9b (diff)
downloadroflnauts-efe80dc4f1e5c52929717b442e6305731577808c.zip
roflnauts-efe80dc4f1e5c52929717b442e6305731577808c.tar.gz
roflnauts-efe80dc4f1e5c52929717b442e6305731577808c.tar.bz2
Get initial value from metatable
-rw-r--r--player.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/player.lua b/player.lua
index 133e266..40d091c 100644
--- a/player.lua
+++ b/player.lua
@@ -22,8 +22,7 @@ Player = {
lives = 3,
spawntimer = 2,
alive = true,
- punchcd = 0,
- punchinitial = 0.25,
+ punchcd = 0.25,
punchdir = 0, -- a really bad thing
-- Animation
animations = require "animations",
@@ -68,6 +67,7 @@ function Player:new (game, world, x, y, name)
o.name = name or "empty"
o.sprite = newImage("assets/nauts/"..o.name..".png")
o.world = game
+ o.punchcd = 0
-- Animation
o.current = o.animations.idle
o:createEffect("respawn")
@@ -380,7 +380,7 @@ end
-- (string) direction
function Player:hit(direction)
-- start cooldown
- self.punchcd = self.punchinitial
+ self.punchcd = Player.punchcd -- INITIAL from metatable
-- actual punch
local fixture
if direction == "left" then