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,
|
tilewidth = 16,
|
||||||
tileheight = 16,
|
tileheight = 16,
|
||||||
nextlayerid = 7,
|
nextlayerid = 7,
|
||||||
nextobjectid = 10,
|
nextobjectid = 13,
|
||||||
properties = {},
|
properties = {},
|
||||||
tilesets = {
|
tilesets = {
|
||||||
{
|
{
|
||||||
|
@ -458,61 +458,67 @@ return {
|
||||||
name = "",
|
name = "",
|
||||||
type = "",
|
type = "",
|
||||||
shape = "rectangle",
|
shape = "rectangle",
|
||||||
x = 240,
|
x = 176,
|
||||||
y = 144,
|
y = 112,
|
||||||
width = 16,
|
width = 16,
|
||||||
height = 16,
|
height = 16,
|
||||||
rotation = 0,
|
rotation = 0,
|
||||||
visible = true,
|
visible = true,
|
||||||
properties = {
|
properties = {
|
||||||
|
["charId"] = 1,
|
||||||
|
["charset"] = "perso2",
|
||||||
["isSolid"] = true
|
["isSolid"] = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = 5,
|
id = 10,
|
||||||
name = "",
|
name = "",
|
||||||
type = "",
|
type = "",
|
||||||
shape = "rectangle",
|
shape = "rectangle",
|
||||||
x = 288,
|
x = 224,
|
||||||
y = 144,
|
y = 112,
|
||||||
width = 16,
|
width = 16,
|
||||||
height = 16,
|
height = 16,
|
||||||
rotation = 0,
|
rotation = 0,
|
||||||
visible = true,
|
visible = true,
|
||||||
properties = {
|
properties = {
|
||||||
["isSolid"] = false
|
["charId"] = 2,
|
||||||
|
["charset"] = "perso2",
|
||||||
|
["isSolid"] = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = 8,
|
id = 11,
|
||||||
name = "",
|
name = "",
|
||||||
type = "",
|
type = "",
|
||||||
shape = "rectangle",
|
shape = "rectangle",
|
||||||
x = 240,
|
x = 272,
|
||||||
y = 192,
|
y = 112,
|
||||||
width = 16,
|
width = 16,
|
||||||
height = 16,
|
height = 16,
|
||||||
rotation = 0,
|
rotation = 0,
|
||||||
visible = true,
|
visible = true,
|
||||||
properties = {
|
properties = {
|
||||||
["isSolid"] = true,
|
["charId"] = 3,
|
||||||
["needButton"] = false
|
["charset"] = "perso2",
|
||||||
|
["isSolid"] = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = 9,
|
id = 12,
|
||||||
name = "",
|
name = "",
|
||||||
type = "",
|
type = "",
|
||||||
shape = "rectangle",
|
shape = "rectangle",
|
||||||
x = 288,
|
x = 320,
|
||||||
y = 192,
|
y = 112,
|
||||||
width = 16,
|
width = 16,
|
||||||
height = 16,
|
height = 16,
|
||||||
rotation = 0,
|
rotation = 0,
|
||||||
visible = true,
|
visible = true,
|
||||||
properties = {
|
properties = {
|
||||||
["isSolid"] = false,
|
["charId"] = 5,
|
||||||
["needButton"] = false
|
["charset"] = "perso",
|
||||||
|
["isSolid"] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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>
|
<editorsettings>
|
||||||
<export target="test.lua" format="lua"/>
|
<export target="test.lua" format="lua"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
@ -93,26 +93,32 @@
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup id="6" name="gizmo">
|
<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>
|
<properties>
|
||||||
|
<property name="charId" type="int" value="1"/>
|
||||||
|
<property name="charset" value="perso2"/>
|
||||||
<property name="isSolid" type="bool" value="true"/>
|
<property name="isSolid" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="5" x="288" y="144" width="16" height="16">
|
<object id="10" x="224" y="112" 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">
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<property name="charId" type="int" value="2"/>
|
||||||
|
<property name="charset" value="perso2"/>
|
||||||
<property name="isSolid" type="bool" value="true"/>
|
<property name="isSolid" type="bool" value="true"/>
|
||||||
<property name="needButton" type="bool" value="false"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="9" x="288" y="192" width="16" height="16">
|
<object id="11" x="272" y="112" width="16" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="isSolid" type="bool" value="false"/>
|
<property name="charId" type="int" value="3"/>
|
||||||
<property name="needButton" type="bool" value="false"/>
|
<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>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|
|
@ -31,6 +31,9 @@ function Gizmo:applyProperties()
|
||||||
self:addHitbox("btnInput", "btnInput", -1, -1, self.w + 2, self.h + 2, false)
|
self:addHitbox("btnInput", "btnInput", -1, -1, self.w + 2, self.h + 2, false)
|
||||||
end
|
end
|
||||||
self.needButton = self.properties.needButton
|
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
|
end
|
||||||
|
|
||||||
function Gizmo:setDefaultProperties()
|
function Gizmo:setDefaultProperties()
|
||||||
|
|
|
@ -26,6 +26,7 @@ function Parent:initCharset()
|
||||||
self.charset = nil
|
self.charset = nil
|
||||||
self.charDir = "down"
|
self.charDir = "down"
|
||||||
self.cantWalk = false
|
self.cantWalk = false
|
||||||
|
self.cantTurn = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function Parent:setCharset(charset, charId, cantWalk)
|
function Parent:setCharset(charset, charId, cantWalk)
|
||||||
|
@ -45,10 +46,11 @@ end
|
||||||
function Parent:draw()
|
function Parent:draw()
|
||||||
if (self.charset ~= nil) then
|
if (self.charset ~= nil) then
|
||||||
self:drawCharset()
|
self:drawCharset()
|
||||||
end
|
else
|
||||||
if (self.drawDebugBox) then
|
if (self.drawDebugBox) then
|
||||||
love.graphics.rectangle("line", math.floor(self.x), math.floor(self.y), self.w, self.h)
|
love.graphics.rectangle("line", math.floor(self.x), math.floor(self.y), self.w, self.h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return Parent
|
return Parent
|
||||||
|
|
Loading…
Reference in a new issue