feat(world3D): add a way to adapt y position from tiled

This commit is contained in:
Kazhnuz 2019-07-20 16:53:20 +02:00
parent 27773ad8d6
commit c53e91a564
3 changed files with 38 additions and 1 deletions

View File

@ -361,6 +361,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 32
}
},
@ -376,6 +377,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 32
}
},
@ -391,6 +393,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 32
}
},
@ -406,6 +409,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 32
}
},
@ -421,6 +425,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 32
}
}
@ -987,6 +992,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1002,6 +1008,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1017,6 +1024,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1032,6 +1040,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1047,6 +1056,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1062,6 +1072,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1077,6 +1088,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1092,6 +1104,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1107,6 +1120,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
},
@ -1122,6 +1136,7 @@ return {
rotation = 0,
visible = true,
properties = {
["adaptPosition"] = true,
["z"] = 56
}
}

View File

@ -213,26 +213,31 @@
<objectgroup id="8" name="box">
<object id="80" x="64" y="160" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="32"/>
</properties>
</object>
<object id="81" x="96" y="160" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="32"/>
</properties>
</object>
<object id="82" x="128" y="160" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="32"/>
</properties>
</object>
<object id="83" x="112" y="176" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="32"/>
</properties>
</object>
<object id="84" x="80" y="176" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="32"/>
</properties>
</object>
@ -435,51 +440,61 @@
</object>
<object id="55" x="112" y="384" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="68" x="144" y="384" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="69" x="128" y="416" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="70" x="176" y="384" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="71" x="160" y="416" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="72" x="768" y="176" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="73" x="768" y="208" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="74" x="736" y="208" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="75" x="768" y="240" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>
<object id="76" x="800" y="208" width="16" height="16">
<properties>
<property name="adaptPosition" type="bool" value="true"/>
<property name="z" type="int" value="56"/>
</properties>
</object>

View File

@ -125,7 +125,14 @@ end
function World3D:newActorFromMap(objectlayer, object)
local z = object.properties.z or 0
self:newActor(objectlayer.name, object.x, object.y, z)
local adaptPosition = object.properties.adaptPosition or false
local y = object.y
if (adaptPosition) then
y = y + z
end
self:newActor(objectlayer.name, object.x, y, z)
end
function World3D:newCollisionFromMap(objectlayer, object)