Include player's position into the level's format

master
rexim 2018-01-04 00:09:39 +07:00
parent b1f0a048d3
commit 074ae6311c
3 changed files with 21 additions and 7 deletions

View File

@ -31,9 +31,9 @@
inkscape:bbox-nodes="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:zoom="4"
inkscape:cx="576.29169"
inkscape:cy="355.28551"
inkscape:zoom="2.8284271"
inkscape:cx="283.54425"
inkscape:cy="371.82329"
inkscape:window-x="0"
inkscape:window-y="18"
inkscape:window-maximized="0"
@ -144,7 +144,7 @@
height="25"
width="50"
y="200"
x="350" />
x="250" />
<rect
id="rect4-6-5"
style="fill:#0000ff;stroke-width:1"
@ -194,4 +194,12 @@
width="50"
y="223"
x="714" />
<rect
id="player"
style="fill:#00ff00;stroke-width:1"
height="26.414213"
width="27.01903"
y="117.27399"
x="160.26198"
inkscape:label="#rect4-6-3" />
</svg>

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1,3 +1,4 @@
160.26198 117.27399 27.01903 26.414213
18
0.000000 250.000000 50.000000 50.000000
300 200 50 25
@ -9,7 +10,7 @@
300 150 50 50
100 250 50 50
300 100 50 50
350 200 50 25
250 200 50 25
481.5 241 50 9
531.5 241 50 9
531.5 232 50 9

View File

@ -1,8 +1,13 @@
declare namespace svg ="http://www.w3.org/2000/svg";
let $rects := //svg:svg/svg:rect
let $player := for $rect in $rects where $rect/@id = "player" return $rect
let $platforms := for $rect in $rects where $rect/@id != "player" return $rect
return (
count($rects),
for $rect in $rects
for $rect in $player
return concat($rect/@x, " ", $rect/@y, " ", $rect/@width, " ", $rect/@height),
count($platforms),
for $rect in $platforms
where $rect/@id != "player"
return concat($rect/@x, " ", $rect/@y, " ", $rect/@width, " ", $rect/@height)
)