diff --git a/examples/test_scene2/assets/debris.png b/examples/test_scene2/assets/debris.png new file mode 100644 index 0000000..6dde06e Binary files /dev/null and b/examples/test_scene2/assets/debris.png differ diff --git a/examples/test_scene2/assets/poof.lua b/examples/test_scene2/assets/poof.lua new file mode 100644 index 0000000..9872a14 --- /dev/null +++ b/examples/test_scene2/assets/poof.lua @@ -0,0 +1,16 @@ +return { + metadata = { + height = 16, + width = 16, + defaultAnim = "anim" + }, + animations = { + ["anim"] = { + startAt = 1, + endAt = 5, + loop = 1, + speed = 10, + pauseAtEnd = false, + } + } +} diff --git a/examples/test_scene2/assets/poof.png b/examples/test_scene2/assets/poof.png new file mode 100644 index 0000000..3d08f8d Binary files /dev/null and b/examples/test_scene2/assets/poof.png differ diff --git a/examples/test_scene2/assets/weapon.lua b/examples/test_scene2/assets/weapon.lua new file mode 100644 index 0000000..3a83216 --- /dev/null +++ b/examples/test_scene2/assets/weapon.lua @@ -0,0 +1,6 @@ +return { + metadata = { + height = 16, + width = 16 + } +} diff --git a/examples/test_scene2/assets/weapon.png b/examples/test_scene2/assets/weapon.png new file mode 100644 index 0000000..dde9a37 Binary files /dev/null and b/examples/test_scene2/assets/weapon.png differ diff --git a/examples/test_scene2/init.lua b/examples/test_scene2/init.lua index 761ef09..e4ca4a1 100644 --- a/examples/test_scene2/init.lua +++ b/examples/test_scene2/init.lua @@ -24,14 +24,25 @@ local Scene = require "gamecore.modules.scenes" local TestScene = Scene:extend() +local folder = "examples/test_scene2/" + function TestScene:new() TestScene.super.new(self) + self.assets:addImage("debris", folder .. "assets/debris.png") + self.assets:addSprite("poof", folder .. "assets/poof") + self.assets:addTileset("weapon", folder .. "assets/weapon") + self.i = 0 + self.estImpair = false end function TestScene:update(dt) self.i = self.i + dt + + local i = math.floor(self.i) + + self.estImpair = (math.floor(i / 2) ~= (i / 2)) end function TestScene:mousepressed(x, y) @@ -45,6 +56,16 @@ function TestScene:draw() love.graphics.setColor(1, 1, 1, 1) love.graphics.print(math.floor(self.i) .. " ; " .. self.mouse.x .. ":" .. self.mouse.y, 16, 16) + + if self.estImpair then + self.assets.images["debris"]:draw(16, 32) + self.assets.tileset["weapon"]:drawTile(1, 32, 32) + self.assets.sprites["poof"]:drawAnimation(64, 32) + else + love.graphics.setColor(0, 1, 0, 1) + self.assets.images["debris"]:drawMask(16, 32) + utils.graphics.resetColor() + end end return TestScene