diff --git a/Makefile b/Makefile index 932d913..0c4ef85 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,11 @@ all: win32 win64 linux love: clean_love mkdir -p build - cd src && zip -9 -r ../build/$(name).love . + cd src && zip -9 -r ../build/$(name).love . \ + -x *.tiled-project \ + -x *.tiled-session \ + -x *.tsx \ + -x *.tmx \ win32: clean_windows download-love-win32 love mkdir -p build/win32/$(name) diff --git a/src/systems/player.lua b/src/systems/player.lua index 3d1c7af..01811b3 100644 --- a/src/systems/player.lua +++ b/src/systems/player.lua @@ -106,8 +106,10 @@ function Player:update(dt) if e.acc.x ~= 0 or e.acc.y ~= 0 then e.sprite.variant = "walk" + e.sprite.wobble = true else e.sprite.variant = "idle" + e.sprite.wobble = false end if e.acc.x < 0 then diff --git a/src/systems/sprite.lua b/src/systems/sprite.lua index 727ebd6..79686a2 100644 --- a/src/systems/sprite.lua +++ b/src/systems/sprite.lua @@ -39,6 +39,7 @@ function Sprite:draw() if not e.hidden then local variant = sprite.variants[e.sprite.variant or "default"] if variant and e.sprite.frame then + local rotation = nil local frame = variant[e.sprite.frame] if not frame then frame = variant[1] @@ -47,11 +48,17 @@ function Sprite:draw() if e.sprite.flip then sx = -1 end + + if e.sprite.wobble then + rotation = math.sin(love.timer.getTime()*10)*0.15 + end + love.graphics.draw( frame.image, e.pos.x, e.pos.y, - 0, sx, 1, + rotation, + sx, 1, sprite.width/2, sprite.height/2 ) end