diff options
-rw-r--r-- | player.lua | 6 | ||||
-rw-r--r-- | world.lua | 2 |
2 files changed, 4 insertions, 4 deletions
@@ -30,7 +30,6 @@ Player = { current = nil, frame = 1, delay = 0.10, - initial = nil, -- Movement inAir = true, salto = false, @@ -67,7 +66,6 @@ function Player:new (game, world, x, y, name) o.sprite = newImage("assets/"..o.name..".png") o.world = game -- Animation - o.initial = o.delay o.current = o.animations.idle o:createEffect("respawn") -- Portrait load for first object created @@ -160,7 +158,7 @@ function Player:update (dt) -- Animation self.delay = self.delay - dt if self.delay < 0 then - self.delay = self.delay + self.initial + self.delay = self.delay + Player.delay -- INITIAL from metatable -- Thank you De Morgan! if self.current.repeated or not (self.frame == self.current.frames) then self.frame = (self.frame % self.current.frames) + 1 @@ -328,7 +326,7 @@ end -- idle, walk, attack, attack_up, attack_down, damage function Player:changeAnimation(animation) self.frame = 1 - self.delay = self.initial + self.delay = Player.delay -- INITIAL from metatable self.current = self.animations[animation] end @@ -357,6 +357,7 @@ function World.beginContact(a, b, coll) local x,y = coll:getNormal() if y == -1 then print(b:getUserData().name .. " is not in air") + -- Move them to Player b:getUserData().inAir = false b:getUserData().jumpnumber = 2 b:getUserData().salto = false @@ -373,6 +374,7 @@ end function World.endContact(a, b, coll) if a:getCategory() == 1 then print(b:getUserData().name .. " is in air") + -- Move them to Player b:getUserData().inAir = true end end |