added draw functions for setScale, rehandled scale, animations now have multiple frame times (this breaks some minor stuff)
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 291 B |
|
@ -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
|
||||
if self.subframe > self.frames[self.frame] then
|
||||
self.subframe = self.subframe - self.frames[self.frame]
|
||||
self.frame = self.frame + 1
|
||||
self.subframe = self.subframe - self.speed
|
||||
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
|
||||
|
|
|
@ -14,7 +14,7 @@ end
|
|||
|
||||
function Canvas:Recreate()
|
||||
self.canvas:release()
|
||||
self = Canvas:New()
|
||||
self = Canvas:New(self.name)
|
||||
end
|
||||
|
||||
function Canvas:Reset()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -87,7 +87,7 @@ function GameDraw()
|
|||
GameworldDrawEnd()
|
||||
|
||||
-- hud
|
||||
textScale = 0.5
|
||||
textScale = 1
|
||||
|
||||
-- debug
|
||||
if debug then DebugUI() end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ require "code/locale"
|
|||
|
||||
-- support functions
|
||||
require "code/math"
|
||||
require "code/draw"
|
||||
require "code/hex"
|
||||
require "code/in_out"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|