From ec04a8c86c5e8cd339764ac7dbc2a70566a120b3 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 21 Mar 2021 19:21:51 +0100 Subject: [PATCH] feat: add charset attribution to gizmo --- .../datas/gamedata/maps/sti/plain/test.lua | 40 +++++++++++-------- .../datas/gamedata/maps/sti/plain/test.tmx | 30 ++++++++------ .../scenes/overworld/actors/gizmo.lua | 3 ++ .../scenes/overworld/actors/parent.lua | 8 ++-- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua index 2684a66..43bf338 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua @@ -9,7 +9,7 @@ return { tilewidth = 16, tileheight = 16, nextlayerid = 7, - nextobjectid = 10, + nextobjectid = 13, properties = {}, tilesets = { { @@ -458,61 +458,67 @@ return { name = "", type = "", shape = "rectangle", - x = 240, - y = 144, + x = 176, + y = 112, width = 16, height = 16, rotation = 0, visible = true, properties = { + ["charId"] = 1, + ["charset"] = "perso2", ["isSolid"] = true } }, { - id = 5, + id = 10, name = "", type = "", shape = "rectangle", - x = 288, - y = 144, + x = 224, + y = 112, width = 16, height = 16, rotation = 0, visible = true, properties = { - ["isSolid"] = false + ["charId"] = 2, + ["charset"] = "perso2", + ["isSolid"] = true } }, { - id = 8, + id = 11, name = "", type = "", shape = "rectangle", - x = 240, - y = 192, + x = 272, + y = 112, width = 16, height = 16, rotation = 0, visible = true, properties = { - ["isSolid"] = true, - ["needButton"] = false + ["charId"] = 3, + ["charset"] = "perso2", + ["isSolid"] = true } }, { - id = 9, + id = 12, name = "", type = "", shape = "rectangle", - x = 288, - y = 192, + x = 320, + y = 112, width = 16, height = 16, rotation = 0, visible = true, properties = { - ["isSolid"] = false, - ["needButton"] = false + ["charId"] = 5, + ["charset"] = "perso", + ["isSolid"] = true } } } diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx index 01a28ea..80807ba 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx @@ -1,5 +1,5 @@ - + @@ -93,26 +93,32 @@ - + + + - - - - - - + + + - - + - - + + + + + + + + + + diff --git a/sonic-radiance.love/scenes/overworld/actors/gizmo.lua b/sonic-radiance.love/scenes/overworld/actors/gizmo.lua index 920d028..94d3df2 100644 --- a/sonic-radiance.love/scenes/overworld/actors/gizmo.lua +++ b/sonic-radiance.love/scenes/overworld/actors/gizmo.lua @@ -31,6 +31,9 @@ function Gizmo:applyProperties() self:addHitbox("btnInput", "btnInput", -1, -1, self.w + 2, self.h + 2, false) end self.needButton = self.properties.needButton + self.charId = self.properties.charId or 1 + self.charset = self.properties.charset or nil + self.cantTurn = self.properties.cantTurn or self.cantTurn end function Gizmo:setDefaultProperties() diff --git a/sonic-radiance.love/scenes/overworld/actors/parent.lua b/sonic-radiance.love/scenes/overworld/actors/parent.lua index 156662f..4d61e07 100644 --- a/sonic-radiance.love/scenes/overworld/actors/parent.lua +++ b/sonic-radiance.love/scenes/overworld/actors/parent.lua @@ -26,6 +26,7 @@ function Parent:initCharset() self.charset = nil self.charDir = "down" self.cantWalk = false + self.cantTurn = false end function Parent:setCharset(charset, charId, cantWalk) @@ -45,9 +46,10 @@ end function Parent:draw() if (self.charset ~= nil) then self:drawCharset() - end - if (self.drawDebugBox) then - love.graphics.rectangle("line", math.floor(self.x), math.floor(self.y), self.w, self.h) + else + if (self.drawDebugBox) then + love.graphics.rectangle("line", math.floor(self.x), math.floor(self.y), self.w, self.h) + end end end