summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--entity.lua4
-rw-r--r--player.lua10
2 files changed, 8 insertions, 6 deletions
diff --git a/entity.lua b/entity.lua
index c85dc71..6c922aa 100644
--- a/entity.lua
+++ b/entity.lua
@@ -35,8 +35,8 @@ end
function Entity:syncFromPhysicsBody()
if not self.body then return end
- self.x = self.body:getX() - self.physicsWidth
- self.y = self.body:getY() - self.height + self.physicsHeight / 2
+ self.x = self.body:getX() - self.physicsWidth / 2
+ self.y = self.body:getY() - self.physicsHeight / 2
end
function getEntityCorners(entity)
diff --git a/player.lua b/player.lua
index de02625..14f0885 100644
--- a/player.lua
+++ b/player.lua
@@ -27,11 +27,12 @@ function Player.new(world, spawnX, spawnY)
self.jumpsUsed = 0
self.animations = {
idle = Animation.new("assets/player/idle.png", 16, 16, 0.6),
- running = Animation.new("assets/player/running.png", 16, 16, 0.9),
+ running = Animation.new("assets/player/running.png", 16, 16, 0.4),
going_up = Animation.new("assets/player/going_up.png", 16, 16, 0.8),
going_down = Animation.new("assets/player/going_down.png", 16, 16, 0.5),
- stop_running = Animation.new("assets/player/stop_running.png", 16, 16, 0.3),
- ground_hit = Animation.new("assets/player/ground_hit.png", 16, 16, 0.3)
+ stop_running = Animation.new("assets/player/stop_running.png", 16, 16, 0.5),
+ ground_hit = Animation.new("assets/player/ground_hit.png", 16, 16, 0.5),
+ swimming = Animation.new("assets/player/swimming.png", 16, 16, 0.5)
}
if love and love.filesystem and love.filesystem.getDirectoryItems then
local ok, items = pcall(love.filesystem.getDirectoryItems, "assets/player")
@@ -139,6 +140,7 @@ function Player:update(dt)
moveY = moveY / inputLen
end
+ if move ~= 0 then self.lastFacing = move end
self.body:applyForce(move * SWIM_SPEED, moveY * SWIM_SPEED)
elseif onFloor or onWaterSurface then
self.body:setLinearDamping(0)
@@ -191,7 +193,7 @@ function Player:update(dt)
running = self.animations.running,
jumping = self.animations.going_up,
falling = self.animations.going_down,
- swimming = self.animations.going_down,
+ swimming = self.animations.swimming,
stop_running = self.animations.stop_running,
ground_hit = self.animations.ground_hit,
}