dynamic sprite loading

This commit is contained in:
jill 2021-01-26 00:17:32 +03:00
parent c575497b3f
commit 738398fc2b
Signed by: oat
GPG key ID: DD83A9617A252385
2 changed files with 21 additions and 3 deletions

View file

@ -1,6 +1,8 @@
function love.conf(t)
t.version = "11.1"
t.version = '11.1'
t.release = false
t.identity = 'notsanequarium'
t.appendidentity = true
t.window.title = 'notsanequarium'
t.window.resizable = true
t.window.vsync = false
@ -9,6 +11,13 @@ function love.conf(t)
t.window.width = 640
t.window.height = 480
t.modules.physics = false
t.modules.joystick = false
t.modules.video = false
t.modules.data = false
t.modules.math = false
t.modules.thread = false
-- t.window.msaa = 2
t.releases = {

View file

@ -1,11 +1,13 @@
require 'lib.audio'
local assets = {}
local rawsprites = {}
function assets.clear()
print(" clearing assets")
sprites = {}
rawsprites = {}
sound_path = {}
music_path = {}
end
@ -13,8 +15,15 @@ end
function assets.load(base)
print(" loading " .. base)
assets.addSprites(base)
print("✓ added sprites")
setmetatable(sprites, {__index = function(tbl, i)
if rawsprites[i] then return rawsprites[i] end
local sprite = love.graphics.newImage('assets/sprites/' .. i .. '.png')
rawsprites[i] = sprite
return sprite
end})
--assets.addSprites(base)
--print("✓ added sprites")
assets.addAudio(base)
print("✓ added audio")