parent
2c2bee9409
commit
dd4d212721
13 changed files with 74 additions and 9 deletions
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
18
sonic-radiance.love/assets/sprites/gfx/sparkles.lua
Normal file
18
sonic-radiance.love/assets/sprites/gfx/sparkles.lua
Normal file
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
BIN
sonic-radiance.love/assets/sprites/gfx/sparkles.png
Normal file
BIN
sonic-radiance.love/assets/sprites/gfx/sparkles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 785 B |
|
@ -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...},
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
16
sonic-radiance.love/game/events/event/showGFX.lua
Normal file
16
sonic-radiance.love/game/events/event/showGFX.lua
Normal file
|
@ -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;
|
24
sonic-radiance.love/scenes/overworld/actors/gfx.lua
Normal file
24
sonic-radiance.love/scenes/overworld/actors/gfx.lua
Normal file
|
@ -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
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"},
|
||||
|
|
Loading…
Reference in a new issue