diff --git a/sonic-radiance.love/assets/sprites/gfx/smallsmoke.lua b/sonic-radiance.love/assets/sprites/gfx/smallsmoke.lua index 4dbd8f2..f03c073 100644 --- a/sonic-radiance.love/assets/sprites/gfx/smallsmoke.lua +++ b/sonic-radiance.love/assets/sprites/gfx/smallsmoke.lua @@ -1,18 +1,18 @@ return { metadata = { - height = 16, - width = 16, + width = 18, + height = 22, defaultAnim = "default", - ox = 8, - oy = 8, + ox = 9, + oy = 11, }, animations = { ["default"] = { startAt = 1, - endAt = 8, + endAt = 5, loop = 1, speed = 15, - pauseAtEnd = false, + pauseAtEnd = true, }, } } diff --git a/sonic-radiance.love/assets/sprites/gfx/smallsmoke.png b/sonic-radiance.love/assets/sprites/gfx/smallsmoke.png index 94ac95d..36be9e7 100644 Binary files a/sonic-radiance.love/assets/sprites/gfx/smallsmoke.png and b/sonic-radiance.love/assets/sprites/gfx/smallsmoke.png differ diff --git a/sonic-radiance.love/assets/sprites/gfx/sparkles.lua b/sonic-radiance.love/assets/sprites/gfx/sparkles.lua new file mode 100644 index 0000000..bf392eb --- /dev/null +++ b/sonic-radiance.love/assets/sprites/gfx/sparkles.lua @@ -0,0 +1,18 @@ +return { + metadata = { + width = 16, + height = 16, + defaultAnim = "default", + ox = 8, + oy = 8, + }, + animations = { + ["default"] = { + startAt = 1, + endAt = 4, + loop = 1, + speed = 20, + pauseAtEnd = true, + }, + } +} diff --git a/sonic-radiance.love/assets/sprites/gfx/sparkles.png b/sonic-radiance.love/assets/sprites/gfx/sparkles.png new file mode 100644 index 0000000..4415eb1 Binary files /dev/null and b/sonic-radiance.love/assets/sprites/gfx/sparkles.png differ diff --git a/sonic-radiance.love/game/events/arguments.lua b/sonic-radiance.love/game/events/arguments.lua index e642aa1..d1268a2 100644 --- a/sonic-radiance.love/game/events/arguments.lua +++ b/sonic-radiance.love/game/events/arguments.lua @@ -6,7 +6,8 @@ return { ["playSFX"] = {"sfx"}, ["getRings"] = {"number"}, ["getItems"] = {"type", "item", "number"}, - ["teleport"] = {"area", "x", "y", "charDir"} + ["teleport"] = {"area", "x", "y", "charDir"}, + ["showGFX"] = {"x", "y", "spritename"} --[name] = {args...}, } diff --git a/sonic-radiance.love/game/events/event/init.lua b/sonic-radiance.love/game/events/event/init.lua index 2c10671..15afa66 100644 --- a/sonic-radiance.love/game/events/event/init.lua +++ b/sonic-radiance.love/game/events/event/init.lua @@ -6,5 +6,6 @@ return { ["playSFX"] = require("game.events.event.playSFX"), ["getRings"] = require("game.events.event.getRings"), ["getItems"] = require("game.events.event.getItems"), - ["teleport"] = require("game.events.event.teleport") + ["teleport"] = require("game.events.event.teleport"), + ["showGFX"] = require("game.events.event.showGFX") } \ No newline at end of file diff --git a/sonic-radiance.love/game/events/event/showGFX.lua b/sonic-radiance.love/game/events/event/showGFX.lua new file mode 100644 index 0000000..2e83cbc --- /dev/null +++ b/sonic-radiance.love/game/events/event/showGFX.lua @@ -0,0 +1,16 @@ +local StepParent = require "game.events.event.parent" +local SimpleMessageStep = StepParent:extend() + +function SimpleMessageStep:new(controller, args) + SimpleMessageStep.super.new(self, controller, args) +end + +function SimpleMessageStep:start() + self.events.scene.world.obj.GFX(self.events.scene.world, self.arguments.x, self.arguments.y, self.arguments.spritename) +end + +function SimpleMessageStep:update(dt) + self:finish() +end + +return SimpleMessageStep; diff --git a/sonic-radiance.love/scenes/overworld/actors/gfx.lua b/sonic-radiance.love/scenes/overworld/actors/gfx.lua new file mode 100644 index 0000000..0ad5c02 --- /dev/null +++ b/sonic-radiance.love/scenes/overworld/actors/gfx.lua @@ -0,0 +1,24 @@ +local cwd = (...):gsub('%.gfx$', '') .. "." +local Parent = require(cwd .. "parent") +local GFX = Parent:extend() + +function GFX:new(world, x, y, spritename) + local width, height = world.scene.assets.sprites[spritename]:getDimensions() + + GFX.super.new(self, world, "gfx", x - (width/2), y - (height/2), width, height) + self:setSprite(spritename) + self:cloneSprite() + print(self.x, self.y, spritename) +end + +function GFX:animationEnded(animation) + core.debug:print("gfx2D", 'Current animation "' .. animation .. '" have ended, destroying gfx') + self:destroy() +end + +function GFX:draw() + local x, y = math.floor(self.x), math.floor(self.y) + self:drawSprite(x, y) +end + +return GFX \ No newline at end of file diff --git a/sonic-radiance.love/scenes/overworld/actors/init.lua b/sonic-radiance.love/scenes/overworld/actors/init.lua index 7c6481f..4637d79 100644 --- a/sonic-radiance.love/scenes/overworld/actors/init.lua +++ b/sonic-radiance.love/scenes/overworld/actors/init.lua @@ -7,6 +7,7 @@ Obj.Gizmo = require(cwd .. "gizmo") Obj.Teleporter = require(cwd .. "teleport") Obj.PNJ = require(cwd .. "pnj") Obj.Encounter = require(cwd .. "encounter") +Obj.GFX = require(cwd .. "gfx") Obj.loot = require(cwd .. "loot") diff --git a/sonic-radiance.love/scenes/overworld/actors/loot/itembox.lua b/sonic-radiance.love/scenes/overworld/actors/loot/itembox.lua index 7c5f61b..23dd48d 100644 --- a/sonic-radiance.love/scenes/overworld/actors/loot/itembox.lua +++ b/sonic-radiance.love/scenes/overworld/actors/loot/itembox.lua @@ -21,6 +21,7 @@ function ItemBox:applyProperties() {"getItems", "", self.properties.category, self.properties.item, self.properties.number}, {"playSFX", "", "pop"}, {"simpleMessage", "", "You got " .. self.properties.number .. " " .. self.properties.item}, + {"showGFX", "", self.x + 16, self.y + 14, "smallsmoke"} } end diff --git a/sonic-radiance.love/scenes/overworld/actors/loot/ring.lua b/sonic-radiance.love/scenes/overworld/actors/loot/ring.lua index 242f45d..fb78260 100644 --- a/sonic-radiance.love/scenes/overworld/actors/loot/ring.lua +++ b/sonic-radiance.love/scenes/overworld/actors/loot/ring.lua @@ -15,9 +15,9 @@ function Ring:new(world, x, y) end function Ring:action() - self.assets.sfx["ring"]:stop() self.assets.sfx["ring"]:play() game.loot.rings = game.loot.rings + 1 + self.world.obj.GFX(self.world, self.x + 16, self.y + 12, "sparkles") end return Ring \ No newline at end of file diff --git a/sonic-radiance.love/scenes/overworld/actors/loot/ringbox.lua b/sonic-radiance.love/scenes/overworld/actors/loot/ringbox.lua index 56980a2..94c5369 100644 --- a/sonic-radiance.love/scenes/overworld/actors/loot/ringbox.lua +++ b/sonic-radiance.love/scenes/overworld/actors/loot/ringbox.lua @@ -21,6 +21,7 @@ function RingBox:applyProperties() {"getRings", "", self.properties.number}, {"playSFX", "", "pop"}, {"simpleMessage", "", "You got " .. self.properties.number .. " rings"}, + {"showGFX", "", self.x + 16, self.y + 14, "smallsmoke"} } end diff --git a/sonic-radiance.love/scenes/overworld/assets.lua b/sonic-radiance.love/scenes/overworld/assets.lua index 46187d3..a01c280 100644 --- a/sonic-radiance.love/scenes/overworld/assets.lua +++ b/sonic-radiance.love/scenes/overworld/assets.lua @@ -11,6 +11,8 @@ return { {"encounter", "assets/sprites/encounter"}, {"punch", "assets/sprites/gfx/punch"}, {"dash", "assets/sprites/gfx/dash"}, + {"smallsmoke", "assets/sprites/gfx/smallsmoke"}, + {"sparkles", "assets/sprites/gfx/sparkles"}, }, ["textures"] = { {"menucursor", "assets/gui/cursor-menulist.png"},