diff --git a/assets/entities/cursed_book/flying2.png b/assets/entities/cursed_book/flying2.png index 2d924b4..82b5b27 100644 Binary files a/assets/entities/cursed_book/flying2.png and b/assets/entities/cursed_book/flying2.png differ diff --git a/assets/entities/cursed_book/flying3.png b/assets/entities/cursed_book/flying3.png index 82b5b27..c9dcb7f 100644 Binary files a/assets/entities/cursed_book/flying3.png and b/assets/entities/cursed_book/flying3.png differ diff --git a/assets/entities/cursed_book/flying4.png b/assets/entities/cursed_book/flying4.png index 82b5b27..9bddff8 100644 Binary files a/assets/entities/cursed_book/flying4.png and b/assets/entities/cursed_book/flying4.png differ diff --git a/assets/entities/cursed_book/flying5.png b/assets/entities/cursed_book/flying5.png index c9dcb7f..ad45799 100644 Binary files a/assets/entities/cursed_book/flying5.png and b/assets/entities/cursed_book/flying5.png differ diff --git a/assets/entities/cursed_book/flying7.png b/assets/entities/cursed_book/flying7.png index ad45799..c9dcb7f 100644 Binary files a/assets/entities/cursed_book/flying7.png and b/assets/entities/cursed_book/flying7.png differ diff --git a/assets/entities/cursed_book/flying8.png b/assets/entities/cursed_book/flying8.png index 9bddff8..82b5b27 100644 Binary files a/assets/entities/cursed_book/flying8.png and b/assets/entities/cursed_book/flying8.png differ diff --git a/assets/entities/kupo/kupo1.png b/assets/entities/kupo/kupo1.png index 7c2bb42..aaf4ff5 100644 Binary files a/assets/entities/kupo/kupo1.png and b/assets/entities/kupo/kupo1.png differ diff --git a/assets/entities/kupo/kupo2.png b/assets/entities/kupo/kupo2.png index b054ed7..ac4b454 100644 Binary files a/assets/entities/kupo/kupo2.png and b/assets/entities/kupo/kupo2.png differ diff --git a/assets/entities/kupo/kupo3.png b/assets/entities/kupo/kupo3.png index caa2541..ffbf849 100644 Binary files a/assets/entities/kupo/kupo3.png and b/assets/entities/kupo/kupo3.png differ diff --git a/assets/entities/kupo/kupo4.png b/assets/entities/kupo/kupo4.png index 61f6f5e..0cbad4d 100644 Binary files a/assets/entities/kupo/kupo4.png and b/assets/entities/kupo/kupo4.png differ diff --git a/code/animation.lua b/code/animation.lua index 766cf04..4e6b23c 100644 --- a/code/animation.lua +++ b/code/animation.lua @@ -5,7 +5,6 @@ function Animation:New(anim_data) o.path = anim_data.path o.frames = anim_data.frames - o.speed = anim_data.speed o.imgs = anim_data.imgs o.subframe = 0 o.frame = 1 @@ -26,8 +25,8 @@ end -- to manually handle what frame function Animation:DrawFrame(frame, x, y, rotate, sx, sy) - if frame > self.frames then - frame = self.frames + if frame > #self.frames then + frame = #self.frames end local x = x or 0 local y = y or 0 @@ -45,18 +44,18 @@ end -- to linearly animate function Animation:Animate() - if self.speed ~= 0 then + if self.frames[self.frame] ~= 0 then -- try to animate self.subframe = self.subframe + current_dt - if self.subframe > self.speed then - self.frame = self.frame + 1 - self.subframe = self.subframe - self.speed + if self.subframe > self.frames[self.frame] then + self.subframe = self.subframe - self.frames[self.frame] + self.frame = self.frame + 1 end -- cycle - if self.frame >= self.frames+1 then - self.frame = self.frame - self.frames + if self.frame >= #self.frames+1 then + self.frame = self.frame - #self.frames end end end diff --git a/code/canvas.lua b/code/canvas.lua index e75d64b..42722b7 100644 --- a/code/canvas.lua +++ b/code/canvas.lua @@ -14,7 +14,7 @@ end function Canvas:Recreate() self.canvas:release() - self = Canvas:New() + self = Canvas:New(self.name) end function Canvas:Reset() diff --git a/code/debug.lua b/code/debug.lua index f2951d4..e3ccc73 100644 --- a/code/debug.lua +++ b/code/debug.lua @@ -1,4 +1,6 @@ function DebugUI() + love.graphics.setScale() + local mouse_x, mouse_y = love.mouse.getPosition() for _, light in pairs(LoadedObjects.Lights) do love.graphics.print(light.pos.x,light.pos.x,light.pos.y) @@ -24,11 +26,13 @@ function DebugUI() end function DebugColisions() + love.graphics.setScale(game.scale) -- DrawColisionTable() LoadedObjects.DrawCollisions() end function DebugEntities() + love.graphics.setScale(game.scale) for _, particle in pairs(LoadedParticles) do particle:Debug() end diff --git a/code/draw.lua b/code/draw.lua new file mode 100644 index 0000000..7bce9dd --- /dev/null +++ b/code/draw.lua @@ -0,0 +1,6 @@ +function love.graphics.setScale(scale_x, scale_y) + local scale_x = scale_x or 1 + local scale_y = scale_y or scale_x + love.graphics.origin() + love.graphics.scale(scale_x,scale_y) +end diff --git a/code/game.lua b/code/game.lua index 4d543b8..6113872 100644 --- a/code/game.lua +++ b/code/game.lua @@ -87,7 +87,7 @@ function GameDraw() GameworldDrawEnd() -- hud - textScale = 0.5 + textScale = 1 -- debug if debug then DebugUI() end diff --git a/code/gameworld.lua b/code/gameworld.lua index e8f0f10..79f2324 100644 --- a/code/gameworld.lua +++ b/code/gameworld.lua @@ -5,7 +5,7 @@ function GameworldDrawPrepare() Canvas.Darkness.Recreate() end pcr, pcg, pcb, pca = love.graphics.getColor() - love.graphics.scale(game.scale,game.scale) + love.graphics.setScale(game.scale,game.scale) love.graphics.setColor(1,1,1,1) end diff --git a/code/menu.lua b/code/menu.lua index 25b0c79..125cb1b 100644 --- a/code/menu.lua +++ b/code/menu.lua @@ -1,8 +1,9 @@ function MenuDraw(menu) local font = love.graphics.getFont() love.graphics.setFont(LocaleFont) - -- Set scale to 1 - love.graphics.scale(0.5,0.5) + + -- reset scale + love.graphics.setScale() if menu == "pause" then MenuDrawPauseScreen() @@ -13,8 +14,7 @@ function MenuDraw(menu) for _, element in pairs(UIElement) do element:Draw() end - -- Reset scale - love.graphics.scale(2,2) + love.graphics.setFont(font) end diff --git a/code/require.lua b/code/require.lua index 54282e0..2cf548d 100644 --- a/code/require.lua +++ b/code/require.lua @@ -8,6 +8,7 @@ require "code/locale" -- support functions require "code/math" +require "code/draw" require "code/hex" require "code/in_out" diff --git a/data/animations.lua b/data/animations.lua index 826bf14..7f821e3 100644 --- a/data/animations.lua +++ b/data/animations.lua @@ -5,118 +5,194 @@ animation = {} animation.cursed_book = {} animation.cursed_book.attack_loop = { path = "assets/entities/cursed_book/attack_loop", - frames = 1, - speed = 0 + frames = { + 0 + } } animation.cursed_book.attack_transition = { path = "assets/entities/cursed_book/attack_transition", - frames = 5, - speed = 1/16 + frames = { + 1/16, + 1/16, + 1/16, + 1/16, + 1/16 + } } animation.cursed_book.flying = { path = "assets/entities/cursed_book/flying", - frames = 11, - speed = 1/16 + frames = { + 2/16, + 2/16, + 1/16, + 1/16, + 1/16, + 1/16, + 1/16, + 2/16 + } } animation.cursed_book.spawn = { path = "assets/entities/cursed_book/spawn", - frames = 5, - speed = 0 + frames = { + 0, + 0, + 0, + 0, + 0 + } } -- particles animation.particle = {} animation.particle.simple = { path = "assets/entities/particle/simple", - frames = 4, - speed = 1/4 + frames = { + 1/4, + 1/4, + 1/4, + 1/4 + } } -- fairy animation.fairy = {} animation.fairy.flying = { path = "assets/entities/fairy/flying", - frames = 2, - speed = 1/30 + frames = { + 1/32, + 1/32 + } } -- decoration animation.decoration = {} animation.decoration.candelabra = { path = "assets/entities/decoration/candelabra", - frames = 8, - speed = 1/6 + frames = { + 1/8, + 1/8, + 1/8, + 1/8, + 1/8, + 1/8, + 1/8, + 1/8 + } } -- kupo animation.kupo = {} animation.kupo.body = { path = "assets/entities/kupo/kupo", - frames = 4, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8, + 1/8 + } } animation.kupo.bow = { path = "assets/entities/kupo/kupo_bow", - frames = 6, - speed = 1/10 + frames = { + 1/10, + 1/10, + 1/10, + 1/10, + 1/10, + 1/10 + } } animation.kupo.arrow = { path = "assets/entities/kupo/kupo_arrow", - frames = 1, - speed = 0 + frames = { + 0 + } } -- moth mask animation.moth_mask = {} animation.moth_mask.idle = { path = "assets/entities/nancy/moth_mask/idle", - frames = 4, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8, + 1/8 + } } animation.moth_mask.run = { path = "assets/entities/nancy/moth_mask/run", - frames = 6, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8, + 1/8, + 1/8, + 1/8 + } } animation.moth_mask.fall = { path = "assets/entities/nancy/moth_mask/fall", - frames = 3, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8 + } } animation.moth_mask.jump = { path = "assets/entities/nancy/moth_mask/jump", - frames = 3, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8 + } } -- nancy animation.nancy = {} animation.nancy.idle = { path = "assets/entities/nancy/idle", - frames = 4, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8, + 1/8 + } } animation.nancy.run = { path = "assets/entities/nancy/run", - frames = 6, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8, + 1/8, + 1/8, + 1/8 + } } animation.nancy.fall = { path = "assets/entities/nancy/fall", - frames = 3, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8 + } } animation.nancy.jump = { path = "assets/entities/nancy/jump", - frames = 3, - speed = 1/8 + frames = { + 1/8, + 1/8, + 1/8 + } } -- animation initializer for _, object in pairs(animation) do for _, anim in pairs(object) do anim.imgs = {} - for i = 1, anim.frames do + for i = 1, #anim.frames do table.insert(anim.imgs,love.graphics.newImage(anim.path..tostring(i)..".png")) end end