feat: add charset attribution to gizmo
This commit is contained in:
parent
68fc277d05
commit
ec04a8c86c
4 changed files with 49 additions and 32 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="7" nextobjectid="10">
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="7" nextobjectid="13">
|
||||
<editorsettings>
|
||||
<export target="test.lua" format="lua"/>
|
||||
</editorsettings>
|
||||
|
@ -93,26 +93,32 @@
|
|||
</data>
|
||||
</layer>
|
||||
<objectgroup id="6" name="gizmo">
|
||||
<object id="4" x="240" y="144" width="16" height="16">
|
||||
<object id="4" x="176" y="112" width="16" height="16">
|
||||
<properties>
|
||||
<property name="charId" type="int" value="1"/>
|
||||
<property name="charset" value="perso2"/>
|
||||
<property name="isSolid" type="bool" value="true"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="5" x="288" y="144" width="16" height="16">
|
||||
<properties>
|
||||
<property name="isSolid" type="bool" value="false"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="8" x="240" y="192" width="16" height="16">
|
||||
<object id="10" x="224" y="112" width="16" height="16">
|
||||
<properties>
|
||||
<property name="charId" type="int" value="2"/>
|
||||
<property name="charset" value="perso2"/>
|
||||
<property name="isSolid" type="bool" value="true"/>
|
||||
<property name="needButton" type="bool" value="false"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="9" x="288" y="192" width="16" height="16">
|
||||
<object id="11" x="272" y="112" width="16" height="16">
|
||||
<properties>
|
||||
<property name="isSolid" type="bool" value="false"/>
|
||||
<property name="needButton" type="bool" value="false"/>
|
||||
<property name="charId" type="int" value="3"/>
|
||||
<property name="charset" value="perso2"/>
|
||||
<property name="isSolid" type="bool" value="true"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="12" x="320" y="112" width="16" height="16">
|
||||
<properties>
|
||||
<property name="charId" type="int" value="5"/>
|
||||
<property name="charset" value="perso"/>
|
||||
<property name="isSolid" type="bool" value="true"/>
|
||||
</properties>
|
||||
</object>
|
||||
</objectgroup>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,10 +46,11 @@ end
|
|||
function Parent:draw()
|
||||
if (self.charset ~= nil) then
|
||||
self:drawCharset()
|
||||
end
|
||||
else
|
||||
if (self.drawDebugBox) then
|
||||
love.graphics.rectangle("line", math.floor(self.x), math.floor(self.y), self.w, self.h)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Parent
|
||||
|
|
Loading…
Reference in a new issue