Fix map renderer

This commit is contained in:
Mootfrost777 2023-08-17 12:11:23 +03:00
parent ced2895873
commit c0c87c23f2
9 changed files with 330 additions and 105 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="5" nextobjectid="3"> <map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="10" nextobjectid="47">
<tileset firstgid="1" source="tiles/map.tsx"/> <tileset firstgid="1" source="map.tsx"/>
<layer id="1" name="Collision" class="collidable" width="30" height="20" visible="0" offsetx="-352.033" offsety="192.098"> <layer id="1" name="Collision" class="collidable" width="30" height="20" locked="1" offsetx="-352.033" offsety="192.098">
<data encoding="csv"> <data encoding="csv">
<chunk x="0" y="-16" width="16" height="16"> <chunk x="0" y="-16" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -311,7 +311,7 @@
</chunk> </chunk>
</data> </data>
</layer> </layer>
<layer id="4" name="Background 2" class="non_collidable" width="30" height="20"> <layer id="4" name="Background 2" class="non_collidable" width="30" height="20" visible="0" locked="1">
<data encoding="csv"> <data encoding="csv">
<chunk x="0" y="0" width="16" height="16"> <chunk x="0" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -441,39 +441,162 @@
</chunk> </chunk>
</data> </data>
</layer> </layer>
<layer id="3" name="Backgrond" class="non_collidable" width="30" height="20" offsetx="-256.033" offsety="256.098"> <objectgroup id="2" name="Collectables 100 - 1" visible="0" locked="1" offsetx="53.25" offsety="-12">
<object id="6" x="81.4167" y="71.3333">
<point/>
</object>
<object id="7" x="128.083" y="168.667">
<point/>
</object>
<object id="10" x="289.417" y="264.667">
<point/>
</object>
<object id="11" x="-144.583" y="358">
<point/>
</object>
<object id="13" x="0.0833333" y="453.333">
<point/>
</object>
<object id="14" x="637.417" y="454.667">
<point/>
</object>
<object id="15" x="640.083" y="359.333">
<point/>
</object>
<object id="16" x="638.75" y="263.333">
<point/>
</object>
<object id="17" x="638.75" y="170">
<point/>
</object>
</objectgroup>
<layer id="6" name="Ladders" class="platform" width="30" height="20" locked="1">
<data encoding="csv"> <data encoding="csv">
<chunk x="0" y="-16" width="16" height="16"> <chunk x="-16" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,144,144,144,144,144,144,144,144,247,144, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,157,157,167,157,157,157,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,157,157,180,157,254,255,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,157,157,193,157,267,268,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,204,204,204,204,280,281,204,272,260,272, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,0,0,0,0,0,260,0, 0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,144,144,144,144,144,260,144, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157, 0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157, 0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,204,272,157,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,0,0,157,157,157,260,157, 0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,144,144,157,157,157,260,157, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157, 0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="32" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="-16" y="16" width="16" height="16">
0,0,0,0,0,0,147,199,148,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="32" y="16" width="16" height="16">
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,160,199,161,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
183,184,185,186,199,187,188,189,190,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
</data>
</layer>
<layer id="3" name="Backgrond" class="non_collidable" width="30" height="20" visible="0" locked="1" offsetx="-256.033" offsety="256.098">
<data encoding="csv">
<chunk x="-16" y="-16" width="16" height="16">
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,2,3,4,
29,29,29,29,5,6,29,29,29,29,29,29,14,15,16,17,
29,29,29,29,29,29,29,29,29,29,29,29,27,28,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,2,3,4,29,29,29,23,24,29,29,29,29,29,
29,29,14,15,16,17,29,29,29,29,29,29,29,29,29,29,
29,29,27,28,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,5,6,
29,29,29,23,24,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
</chunk>
<chunk x="0" y="-16" width="16" height="16">
29,29,29,29,29,0,0,0,0,0,0,0,0,0,0,0,
29,29,29,29,29,0,144,144,144,144,144,144,144,144,247,144,
29,29,29,29,0,0,157,157,167,157,157,157,157,157,260,157,
29,29,29,29,0,0,157,157,180,157,254,255,157,157,260,157,
29,29,29,29,0,0,157,157,193,157,267,268,157,157,260,157,
29,29,29,29,0,0,204,204,204,204,280,281,204,272,260,272,
29,29,29,29,0,0,147,199,148,0,0,0,0,0,260,0,
29,29,29,29,0,0,147,199,148,144,144,144,144,144,260,144,
29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,204,272,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,0,0,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,144,144,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157,
29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157
</chunk> </chunk>
<chunk x="16" y="-16" width="16" height="16"> <chunk x="16" y="-16" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157,
157,157,157,191,192,157,157,252,253,157,157,157,157,157,157,258, 157,157,157,191,192,157,157,252,253,157,157,157,157,157,157,258,
157,157,157,157,157,157,157,265,266,157,157,157,157,157,157,271, 157,157,157,157,157,157,157,265,266,157,157,157,696,697,157,271,
204,204,204,204,204,204,204,278,279,204,204,204,204,204,204,284, 204,204,204,204,204,204,204,278,279,204,204,204,709,710,204,284,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
157,157,157,157,157,157,258,157,157,157,252,253,157,157,157,157, 157,157,157,157,157,157,258,157,157,157,252,253,157,157,157,157,
157,157,157,157,157,157,271,157,157,157,265,266,157,157,157,157, 157,157,157,157,157,157,271,157,157,157,265,266,157,696,697,157,
157,157,272,204,204,204,284,204,204,204,278,279,204,204,204,204, 157,157,272,204,204,204,284,204,204,204,278,279,204,709,710,204,
157,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 157,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
157,157,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,157,157,157,157,157,157,157,167,157,157,209,210, 157,157,157,157,157,157,157,157,157,157,157,167,157,157,209,210,
@ -484,8 +607,8 @@
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,243,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,157,243,157,157,157,157,157,157,157,157,157,157,157,
157,157,157,157,256,257,157,157,157,157,157,157,157,157,157,157, 157,157,157,157,256,257,157,157,157,157,157,157,157,157,157,157,
157,157,157,157,269,270,157,157,157,157,157,261,262,263,264,157, 157,157,157,157,269,270,157,157,157,157,217,261,262,263,264,217,
204,204,204,204,282,283,204,204,204,204,204,274,275,276,277,204, 204,204,204,204,282,283,204,204,204,204,230,274,275,276,277,230,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,209,210,211,212,157,157,157,167,157,157,157,157, 157,157,157,157,209,210,211,212,157,157,157,167,157,157,157,157,
@ -495,15 +618,15 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
211,212,157,157,157,157,157,157,157,157,157,157,157,157,157,157, 211,212,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
224,225,157,157,252,253,157,157,157,157,157,258,157,157,157,157 224,225,157,157,252,253,157,248,249,157,157,258,157,157,157,157
</chunk> </chunk>
<chunk x="48" y="-16" width="16" height="16"> <chunk x="48" y="-16" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,621,622,144,144,144,0,0,0, 144,144,144,144,144,144,144,144,621,622,144,144,144,0,0,0,
157,157,157,157,157,157,157,157,634,635,157,157,157,0,0,0, 157,157,157,157,157,157,157,157,634,635,157,157,157,0,0,0,
157,157,157,157,157,157,272,157,647,648,157,272,157,0,0,0, 157,248,249,157,157,157,272,157,647,648,157,272,157,0,0,0,
157,157,157,157,157,157,145,147,199,200,148,145,157,0,0,0, 157,250,251,157,157,157,145,147,199,200,148,145,157,0,0,0,
204,204,204,204,204,204,204,160,199,200,161,204,204,0,0,0, 204,239,240,204,204,204,204,160,199,200,161,204,204,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,0,0,0,
178,179,157,157,157,157,157,243,157,157,157,157,157,0,0,0, 178,179,157,157,157,157,157,243,157,157,157,157,157,0,0,0,
@ -516,50 +639,50 @@
254,255,157,147,199,148,157,256,257,157,252,253,157,0,0,0 254,255,157,147,199,148,157,256,257,157,252,253,157,0,0,0
</chunk> </chunk>
<chunk x="-16" y="0" width="16" height="16"> <chunk x="-16" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,2,3,4,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,14,15,16,17,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,27,28,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,5,6,29,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,5,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
0,0,0,19,20,21,22,0,0,0,0,0,0,0,0,0, 29,29,29,19,20,21,22,0,0,29,29,29,29,29,29,29,
0,30,31,32,33,34,35,0,0,0,0,0,0,0,0,0, 29,30,31,32,33,34,35,0,0,29,29,29,29,29,29,29,
0,43,44,45,46,47,48,0,0,0,0,0,0,0,0,0, 29,43,44,45,46,47,48,0,0,29,29,29,29,29,29,29,
64,65,18,58,59,60,18,0,0,0,0,0,0,0,0,0, 64,65,18,58,59,60,18,0,0,29,29,29,29,29,29,29,
77,78,18,71,72,73,18,0,0,68,56,56,55,56,56,69, 77,78,18,71,72,73,18,0,0,68,56,56,55,56,56,69,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk> </chunk>
<chunk x="0" y="0" width="16" height="16"> <chunk x="0" y="0" width="16" height="16">
0,0,0,0,0,0,147,199,148,157,157,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157,
0,0,0,0,0,0,160,200,161,204,204,272,157,157,260,157, 29,29,29,29,0,0,160,200,161,204,204,272,157,157,260,157,
0,0,0,0,0,0,0,0,0,0,0,0,157,157,260,157, 29,29,29,29,0,0,0,0,0,0,0,0,157,157,260,157,
0,0,0,0,0,0,144,144,144,144,144,144,157,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,157,157,260,157,
0,0,0,0,0,0,157,167,157,157,157,157,157,157,260,157, 29,29,29,29,0,0,157,167,157,157,157,157,157,157,260,157,
0,0,0,0,0,0,157,180,157,252,253,157,157,157,260,157, 29,29,29,29,0,0,157,180,157,252,253,157,157,157,260,157,
0,0,0,0,0,0,157,193,157,265,266,157,157,157,260,157, 29,29,29,29,0,0,157,193,157,265,266,157,157,157,260,157,
0,0,0,0,0,0,204,204,204,278,279,204,272,157,260,157, 6,29,29,29,0,0,204,204,204,278,279,204,272,157,260,157,
0,0,0,0,0,0,0,0,0,0,0,0,0,157,260,157, 29,29,29,29,0,0,0,0,0,0,0,0,0,157,260,157,
0,0,0,0,0,0,144,144,144,144,144,144,144,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,144,157,260,157,
0,0,0,0,0,0,157,157,157,157,157,157,157,219,220,221, 29,29,29,29,0,0,157,157,157,157,157,157,157,219,220,221,
0,0,0,12,0,0,157,157,157,254,255,157,157,232,233,234, 29,29,29,12,0,0,157,157,157,254,255,157,157,232,233,234,
0,0,0,0,26,63,157,157,157,267,268,218,213,214,215,216, 29,29,29,29,26,63,157,157,157,267,268,218,213,214,215,216,
0,0,0,38,39,63,204,204,204,280,281,231,226,227,228,229, 29,29,29,38,39,63,204,204,204,280,281,231,226,227,228,229,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 29,29,29,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk> </chunk>
<chunk x="16" y="0" width="16" height="16"> <chunk x="16" y="0" width="16" height="16">
157,157,157,157,267,268,157,157,157,157,157,193,157,157,235,236, 157,157,157,157,267,268,157,696,697,157,157,193,157,157,235,236,
157,272,204,204,280,281,204,204,204,204,204,204,204,204,204,204, 157,272,204,204,280,281,204,709,710,204,204,204,204,204,204,204,
157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
157,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157,
157,157,157,191,192,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,191,192,157,248,249,157,157,157,157,157,157,157,157,
157,157,157,157,157,157,157,157,157,157,261,262,263,264,157,157, 157,157,157,157,157,157,250,251,157,217,261,262,263,264,217,157,
272,204,204,204,204,204,204,204,204,204,274,275,276,277,204,204, 272,204,204,204,204,204,239,240,204,230,274,275,276,277,230,204,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,157,157,157,157,243,157,157,209,210,211,212,157, 157,157,157,157,157,157,157,157,243,157,157,209,210,211,212,157,
@ -570,35 +693,35 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk> </chunk>
<chunk x="32" y="0" width="16" height="16"> <chunk x="32" y="0" width="16" height="16">
237,238,157,157,265,266,157,157,157,157,157,271,157,157,157,157, 237,238,157,157,265,266,157,250,251,157,157,271,157,157,157,157,
204,204,204,204,278,279,204,204,204,204,204,284,204,204,204,204, 204,204,204,204,278,279,204,239,240,204,204,284,204,204,204,204,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,157,157,157,157,157,157,157,243,157,157,209,210,211,212, 157,157,157,157,157,157,157,157,157,243,157,157,209,210,211,212,
157,157,254,255,157,157,157,157,157,256,257,157,222,223,224,225, 157,157,254,255,157,248,249,157,157,256,257,157,222,223,224,225,
157,157,267,268,157,157,157,157,157,269,270,157,235,236,237,238, 157,157,267,268,157,250,251,157,157,269,270,157,235,236,237,238,
204,204,280,281,204,204,204,204,204,282,283,204,204,204,204,204, 204,204,280,281,204,239,240,204,204,282,283,204,204,204,204,204,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
157,157,178,179,157,157,157,157,157,157,157,157,157,157,157,157, 157,157,178,179,157,157,157,157,157,157,157,157,157,157,157,157,
157,157,191,192,157,157,157,157,258,157,157,157,157,157,157,157, 157,157,191,192,157,157,157,157,258,157,157,157,248,249,157,157,
157,157,157,157,157,157,157,157,271,157,157,157,157,157,157,157, 157,157,157,157,157,696,697,157,271,157,157,157,250,251,157,157,
204,204,204,204,204,204,204,204,284,204,204,204,204,204,204,204, 204,204,204,204,204,709,710,204,284,204,204,204,239,240,204,204,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk> </chunk>
<chunk x="48" y="0" width="16" height="16"> <chunk x="48" y="0" width="16" height="16">
267,268,157,147,199,148,157,269,270,157,265,266,157,0,0,0, 267,268,157,147,199,148,157,269,270,157,265,266,218,0,0,0,
280,281,204,160,200,161,204,282,283,204,278,279,204,0,0,0, 280,281,204,160,200,161,204,282,283,204,278,279,231,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0, 0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0, 144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0,
157,157,157,147,199,148,157,157,157,157,157,157,157,0,0,0, 157,157,157,147,199,148,157,157,157,157,157,157,157,0,0,0,
157,157,157,147,199,148,157,157,157,157,252,253,157,0,0,0, 157,157,157,147,199,148,157,157,157,157,252,253,157,0,0,0,
157,157,157,147,199,148,157,157,157,157,265,266,157,0,0,0, 157,157,157,147,199,148,157,217,157,157,265,266,157,0,0,0,
204,204,204,160,200,161,204,204,204,204,278,279,204,0,0,0, 204,204,204,160,200,161,204,230,204,204,278,279,204,0,0,0,
0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0, 0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0,
144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0, 144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0,
157,157,159,160,199,161,162,157,157,157,157,157,157,0,0,0, 157,157,159,160,200,161,162,157,157,157,157,157,157,0,0,0,
157,171,172,173,199,174,175,176,157,157,252,253,157,0,0,0, 157,171,172,173,199,174,175,176,157,157,252,253,157,0,0,0,
183,184,185,186,199,187,188,189,190,157,265,266,157,0,0,0, 183,184,185,186,199,187,188,189,190,157,265,266,157,0,0,0,
196,197,198,199,199,200,201,202,203,204,278,279,204,0,0,0, 196,197,198,199,199,200,201,202,203,204,278,279,204,0,0,0,
@ -607,5 +730,94 @@
</chunk> </chunk>
</data> </data>
</layer> </layer>
<objectgroup id="2" name="Слой объектов 1" offsetx="53.25" offsety="-12"/> <objectgroup id="5" name="Collectables 100 - 2" visible="0" locked="1">
<object id="19" x="696.667" y="40">
<point/>
</object>
<object id="20" x="616" y="40.6667">
<point/>
</object>
<object id="21" x="213.333" y="57.3333">
<point/>
</object>
<object id="22" x="232.667" y="153">
<point/>
</object>
<object id="23" x="137.667" y="247.667">
<point/>
</object>
<object id="24" x="361" y="441.333">
<point/>
</object>
<object id="25" x="488.333" y="341.667">
<point/>
</object>
</objectgroup>
<objectgroup id="8" name="Zombies" locked="1">
<object id="26" x="265" y="469.5">
<point/>
</object>
<object id="27" x="55" y="472.5">
<point/>
</object>
<object id="28" x="488.5" y="472">
<point/>
</object>
<object id="29" x="409.5" y="469.5">
<point/>
</object>
<object id="30" x="665" y="376">
<point/>
</object>
<object id="31" x="521.5" y="373">
<point/>
</object>
<object id="32" x="262" y="372.5">
<point/>
</object>
<object id="33" x="473" y="277.5">
<point/>
</object>
<object id="34" x="152" y="275">
<point/>
</object>
<object id="35" x="485.5" y="181.5">
<point/>
</object>
<object id="36" x="70" y="181">
<point/>
</object>
<object id="37" x="20" y="87">
<point/>
</object>
<object id="38" x="99.5" y="84.5">
<point/>
</object>
<object id="39" x="279" y="83.5">
<point/>
</object>
<object id="40" x="392.5" y="82.5">
<point/>
</object>
<object id="41" x="582" y="83">
<point/>
</object>
</objectgroup>
<objectgroup id="9" name="Short Zombies" locked="1">
<object id="42" x="-141.333" y="373.333">
<point/>
</object>
<object id="43" x="-141.333" y="282.667">
<point/>
</object>
<object id="44" x="-130.667" y="186.667">
<point/>
</object>
<object id="45" x="-132" y="86.6667">
<point/>
</object>
<object id="46" x="641.333" y="274.667">
<point/>
</object>
</objectgroup>
</map> </map>

View file

@ -135,7 +135,7 @@ namespace DangerousD.GameCore
case GameState.Lobby: case GameState.Lobby:
break; break;
case GameState.Game: case GameState.Game:
GameManager.mapManager.LoadLevel("Level1"); GameManager.mapManager.LoadLevel("lvl");
break; break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();

View file

@ -17,12 +17,14 @@ namespace DangerousD.GameCore
public List<LivingEntity> livingEntities; public List<LivingEntity> livingEntities;
public List<Entity> entities; public List<Entity> entities;
public List<MapObject> mapObjects; public List<MapObject> mapObjects;
public List<GameObject> others;
public MapManager mapManager; public MapManager mapManager;
public PhysicsManager physicsManager; public PhysicsManager physicsManager;
public List<Player> players; public List<Player> players;
public Player GetPlayer1 { get; private set; } public Player GetPlayer1 { get; private set; }
public GameManager() public GameManager()
{ {
others = new List<GameObject>();
livingEntities = new List<LivingEntity>(); livingEntities = new List<LivingEntity>();
mapObjects = new List<MapObject>(); mapObjects = new List<MapObject>();
entities = new List<Entity>(); entities = new List<Entity>();
@ -44,15 +46,15 @@ namespace DangerousD.GameCore
{ {
if (gameObject is LivingEntity) if (gameObject is LivingEntity)
livingEntities.Add(gameObject as LivingEntity); livingEntities.Add(gameObject as LivingEntity);
if (gameObject is Entity) else if (gameObject is Entity)
entities.Add(gameObject as Entity); entities.Add(gameObject as Entity);
if (gameObject is MapObject) else if (gameObject is MapObject)
mapObjects.Add(gameObject as MapObject); mapObjects.Add(gameObject as MapObject);
if (gameObject is Player) else if (gameObject is Player)
{ {
players.Add(gameObject as Player); players.Add(gameObject as Player);
GetPlayer1= players[0]; GetPlayer1= players[0];
} }else others.Add(gameObject);
} }
public void Draw(SpriteBatch _spriteBatch) public void Draw(SpriteBatch _spriteBatch)
@ -63,6 +65,8 @@ namespace DangerousD.GameCore
item.Draw(_spriteBatch); item.Draw(_spriteBatch);
foreach (var item in livingEntities) foreach (var item in livingEntities)
item.Draw(_spriteBatch); item.Draw(_spriteBatch);
foreach (var item in others)
item.Draw(_spriteBatch);
} }
public void Update(GameTime gameTime) public void Update(GameTime gameTime)

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Xml; using System.Xml;
using DangerousD.GameCore.GameObjects.MapObjects; using DangerousD.GameCore.GameObjects.MapObjects;
@ -25,9 +26,10 @@ namespace DangerousD.GameCore.Managers
xml.Load($"../../../Content/{level}.tmx"); xml.Load($"../../../Content/{level}.tmx");
Vector2 tileSize = new(int.Parse(xml.DocumentElement.Attributes["tilewidth"].Value), Vector2 tileSize = new(int.Parse(xml.DocumentElement.Attributes["tilewidth"].Value),
int.Parse(xml.DocumentElement.Attributes["tileheight"].Value)); int.Parse(xml.DocumentElement.Attributes["tileheight"].Value));
//tileSize *= _scale;
XmlNodeList layers = xml.DocumentElement.SelectNodes("//layer"); XmlNodeList layers = xml.DocumentElement.SelectNodes("layer");
Debug.Write(layers.Count);
foreach (XmlNode layer in layers) foreach (XmlNode layer in layers)
{ {
InstantiateTiles(layer, tileSize); InstantiateTiles(layer, tileSize);
@ -37,8 +39,12 @@ namespace DangerousD.GameCore.Managers
private void InstantiateTiles(XmlNode layer, Vector2 tileSize) private void InstantiateTiles(XmlNode layer, Vector2 tileSize)
{ {
string tileType = layer.Attributes["class"].Value; string tileType = layer.Attributes["class"].Value;
float offsetX = layer.Attributes["offsetx"] is not null ? float.Parse(layer.Attributes["offsetx"].Value) : 0;
float offsetY = layer.Attributes["offsety"] is not null ? float.Parse(layer.Attributes["offsety"].Value) : 0;
foreach (XmlNode chunk in layer.SelectNodes("//chunk")) Debug.Write(layer.SelectNodes("data/chunk").Count);
foreach (XmlNode chunk in layer.SelectNodes("data/chunk"))
{ {
int chunkW = int.Parse(chunk.Attributes["width"].Value); int chunkW = int.Parse(chunk.Attributes["width"].Value);
int chunkX = int.Parse(chunk.Attributes["x"].Value); int chunkX = int.Parse(chunk.Attributes["x"].Value);
@ -48,25 +54,28 @@ namespace DangerousD.GameCore.Managers
List<int> tiles = chunk.InnerText.Split(',').Select(int.Parse).ToList(); List<int> tiles = chunk.InnerText.Split(',').Select(int.Parse).ToList();
for (int i = 0; i < tiles.Count; i++) for (int i = 0; i < tiles.Count; i++)
{ {
if (tiles[i] == 0) continue; if (tiles[i] != 0)
Vector2 pos = new((chunkX + i % chunkW) * tileSize.X,
(chunkY + i / chunkW) * tileSize.Y);
pos *= _scale;
Rectangle sourceRect = new(new Point(tiles[i] % _columns, tiles[i] / _columns ) * tileSize.ToPoint(), tileSize.ToPoint());
switch (tileType)
{ {
case "collidable": Vector2 pos = new((chunkX+ i % chunkW) * tileSize.X * _scale + offsetX,
new StopTile(pos, tileSize * _scale, sourceRect); (chunkY + i / chunkW) * tileSize.Y * _scale + offsetY);
break; //pos *= _scale;
case "platform": Rectangle sourceRect = new(new Point((tiles[i] -1) % _columns, (tiles[i] -1) / _columns) * tileSize.ToPoint(), tileSize.ToPoint());
new Platform(pos, tileSize * _scale, sourceRect);
break; switch (tileType)
case "non_collidable": {
new Tile(pos, tileSize * _scale, sourceRect); case "collidable":
break; new StopTile(pos, tileSize * _scale, sourceRect);
}} break;
case "platform":
new Platform(pos, tileSize * _scale, sourceRect);
break;
case "non_collidable":
new Tile(pos, tileSize * _scale, sourceRect);
break;
}
}
}
} }
} }