diff --git a/code/entities/hook_anchor.lua b/code/entities/hook_anchor.lua index 354e54c..bbd9781 100644 --- a/code/entities/hook_anchor.lua +++ b/code/entities/hook_anchor.lua @@ -22,14 +22,17 @@ function HookAnchor:New(x,y,hookDistance) end function HookAnchor:HandleAnimation() + self.body:Animate() + self:Draw(self.body) +end + +function HookAnchor:DrawBackground() love.graphics.circle( "line", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, self.hookDistance ) - self.body:Animate() - self:Draw(self.body) end function HookAnchor:DoPhysics() diff --git a/code/entity.lua b/code/entity.lua index 802c01f..e795180 100644 --- a/code/entity.lua +++ b/code/entity.lua @@ -248,6 +248,9 @@ function Entity:Debug() ) end end + +function Entity:DrawBackground() +end require "code/entities/kupo" require "code/entities/arrow" require "code/entities/decoration" diff --git a/code/game.lua b/code/game.lua index 813be24..0d2ebc7 100644 --- a/code/game.lua +++ b/code/game.lua @@ -66,14 +66,22 @@ end function GameDraw() + -- prepare GameworldDrawPrepare() + + -- background GameworldDrawBackground() + GameworldDrawEntitiesBackground() + + -- foreground GameworldDrawForeground() if LevelData.properties.darkness then GameworldDrawLighting() end GameworldDrawParticles() GameworldDrawEntities() + + -- end GameworldDrawEnd() -- hud diff --git a/code/gameworld.lua b/code/gameworld.lua index d556d8d..d419acd 100644 --- a/code/gameworld.lua +++ b/code/gameworld.lua @@ -40,8 +40,14 @@ function GameworldDrawParticles() end end +function GameworldDrawEntitiesBackground() + for _, enty in pairs(LoadedObjects.Entities) do + enty:DrawBackground() + end +end + function GameworldDrawEntities() - love.graphics.setColor(1,1,1) + love.graphics.setColor(0.7,0.7,0.7) for _, enty in pairs(LoadedObjects.Entities) do enty:HandleAnimation() end diff --git a/data/levels/level1.lua b/data/levels/level1.lua index 4a6971e..55880a8 100644 --- a/data/levels/level1.lua +++ b/data/levels/level1.lua @@ -24,7 +24,7 @@ return { { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },