Merge pull request #20 from Ewpratten/map_assets
Map assets merged with player movement and map rendering
BIN
game/dist/assets/env/env_beachTile/env_beachTile.png
vendored
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 26 KiB |
BIN
game/dist/assets/env/env_beachTile/env_beachTileWet.png
vendored
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
game/dist/assets/env/env_boardwalkTile/env_boardwalkTile.png
vendored
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
game/dist/assets/env/env_grassTile/env_grassTile.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
game/dist/assets/env/env_pavementTile/env_pavementTile.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
game/dist/assets/env/env_pavementTile/env_pavementTileLine.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
game/dist/assets/env/env_roadTile/env_roadTile.png
vendored
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
game/dist/assets/env/env_sidewalkTile/env_sidewalkTile.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
236
game/dist/map_gameMap.tmx
vendored
@ -1,42 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.8" tiledversion="1.8.4" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="128" tileheight="128" infinite="1" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" name="env_beachTile" tilewidth="128" tileheight="128" tilecount="2" columns="0">
|
||||
<grid orientation="orthogonal" width="1" height="1"/>
|
||||
<tile id="0">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="1"/>
|
||||
<property name="temperature" type="float" value="10"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_beachTile/env_beachTile.png"/>
|
||||
</tile>
|
||||
<tile id="1">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="5"/>
|
||||
<property name="temperature" type="float" value="1"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_beachTile/env_beachTileSwirly.png"/>
|
||||
</tile>
|
||||
</tileset>
|
||||
<layer id="1" name="Tile Layer 1" width="30" height="20">
|
||||
<data encoding="csv">
|
||||
<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,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,2,2,1,1,2,2,0,0,0,0,
|
||||
0,0,0,0,0,0,2,2,1,1,2,2,0,0,0,0,
|
||||
0,0,0,0,0,0,2,1,0,0,1,2,0,0,0,0,
|
||||
0,0,0,0,0,0,2,2,1,1,2,2,0,0,0,0,
|
||||
0,0,0,0,0,0,2,2,1,1,2,2,0,0,0,0,
|
||||
0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,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>
|
||||
</map>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.8" tiledversion="1.8.4" orientation="orthogonal" renderorder="right-down" width="38" height="128" tilewidth="128" tileheight="128" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" name="floorTiles" tilewidth="128" tileheight="128" tilecount="8" columns="0">
|
||||
<grid orientation="orthogonal" width="1" height="1"/>
|
||||
<tile id="1">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.25"/>
|
||||
<property name="temperature" type="float" value="70"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_roadTile/env_roadTile.png"/>
|
||||
</tile>
|
||||
<tile id="2">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.9"/>
|
||||
<property name="temperature" type="float" value="20"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_pavementTile/env_pavementTile.png"/>
|
||||
</tile>
|
||||
<tile id="3">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.9"/>
|
||||
<property name="temperature" type="float" value="20"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_pavementTile/env_pavementTileLine.png"/>
|
||||
</tile>
|
||||
<tile id="0">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.9"/>
|
||||
<property name="temperature" type="float" value="15"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_sidewalkTile/env_sidewalkTile.png"/>
|
||||
</tile>
|
||||
<tile id="6">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.6"/>
|
||||
<property name="temperature" type="float" value="15"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_beachTile/env_beachTile.png"/>
|
||||
</tile>
|
||||
<tile id="7">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.6"/>
|
||||
<property name="temperature" type="float" value="5"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_beachTile/env_beachTileWet.png"/>
|
||||
</tile>
|
||||
<tile id="5">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="1"/>
|
||||
<property name="temperature" type="float" value="5"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_boardwalkTile/env_boardwalkTile.png"/>
|
||||
</tile>
|
||||
<tile id="4">
|
||||
<properties>
|
||||
<property name="friction" type="float" value="0.5"/>
|
||||
<property name="temperature" type="float" value="5"/>
|
||||
</properties>
|
||||
<image width="128" height="128" source="assets/env/env_grassTile/env_grassTile.png"/>
|
||||
</tile>
|
||||
</tileset>
|
||||
<layer id="1" name="Tile Layer 1" width="38" height="128">
|
||||
<data encoding="csv">
|
||||
8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,7,1073741829,7,1073741829,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,1073741829,1073741829,7,7,7,7,7,7,1073741829,1073741829,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,7,7,7,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,1,3,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,1,3,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,7,1073741829,1073741829,7,7,1073741829,1073741829,1073741829,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,7,1073741829,1,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,3,2147483652,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,7,7,7,7,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,7,1073741829,7,1073741829,1073741829,7,7,7,6,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,7,6,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1073741829,7,7,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,1073741829,1073741829,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1,1,1,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,7,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,7,6,7,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,7,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,7,7,6,1073741829,1073741829,1073741829,7,1073741829,7,7,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,7,7,6,1073741829,1073741829,1073741829,1073741829,7,6,6,7,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,7,1073741829,6,6,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,6,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,7,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,7,6,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,6,6,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,6,6,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,3,3,3,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,3,3,3,536870916,536870916,536870916,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1,1,6,6,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1,4,3,4,3,4,3,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1,4,3,4,3,4,3,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1,4,3,4,3,4,3,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1,1,6,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,7,1073741829,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,7,7,7,7,7,7,7,7,1073741829,6,6,6,6,6,6,6,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,7,7,7,7,7,7,7,7,1073741829,6,6,6,6,6,6,6,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,6,6,6,6,6,1073741829,1073741829,7,7,1073741829,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,6,6,6,6,6,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,7,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,6,6,6,6,6,1073741829,1073741829,1073741829,7,1073741829,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,6,6,1073741829,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,1073741829,1073741829,1073741829,6,6,6,6,6,1073741829,7,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,6,6,1073741829,1073741829,7,7,7,7,7,7,1073741829,1073741829,6,6,6,6,6,1073741829,7,1073741829,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,7,7,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,7,7,1073741829,1,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,7,7,7,7,1073741829,1,1073741829,7,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,7,1073741829,6,6,1073741829,7,7,7,7,7,7,1073741829,1,1073741829,1073741829,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,7,7,7,7,7,1073741829,6,6,1073741829,1073741829,7,7,7,7,1073741829,1073741829,1,1073741829,1073741829,7,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,1073741829,1073741829,1,1073741829,7,7,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,7,7,7,7,1073741829,1073741829,1,1073741829,1073741829,7,7,7,7,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,7,7,1073741829,1073741829,1,7,1073741829,7,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1073741829,1073741829,1073741829,7,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1073741829,1073741829,7,1073741829,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1,1,1,1,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,7,1,1,1,1,1,1073741829,1073741829,1073741829,7,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,6,6,1073741829,7,1073741829,7,1073741829,7,1073741829,1073741829,1073741829,1073741829,7,1,1,1,1,1,1073741829,1073741829,7,7,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,1073741829,1073741829,7,7,7,7,1073741829,7,1073741829,1073741829,1073741829,1,1,1,1,1,1073741829,7,1073741829,7,7,7,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,7,7,1073741829,1073741829,1,1,1,1,1,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,1073741829,1073741829,1073741829,7,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,6,6,1073741829,7,7,7,7,7,7,7,7,7,7,1,1,1,1,1,1073741829,1073741829,1073741829,1073741829,1073741829,7,1,2,2,2,2,2,2,
|
||||
8,8,8,7,7,7,7,6,6,1073741829,7,1073741829,1073741829,1073741829,7,7,1073741829,7,1073741829,1073741829,1,1,1,1,1,1073741829,1073741829,1073741829,7,7,1073741829,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,6,6,1073741829,1073741829,1073741829,7,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1073741829,1,1,1,1,1,1073741829,1073741829,1073741829,7,1073741829,7,1,2,2,2,2,2,2,
|
||||
8,8,7,7,7,7,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,
|
||||
8,7,7,7,7,7,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
|
8
game/dist/project-constants.json
vendored
@ -5,6 +5,7 @@
|
||||
720
|
||||
],
|
||||
"target_fps": 60,
|
||||
"tile_size": 128,
|
||||
"discord": {
|
||||
"app_id": 954413081918857276,
|
||||
"artwork": {
|
||||
@ -15,5 +16,10 @@
|
||||
"details.sm_failure": "Game went FUBAR",
|
||||
"details.main_menu": "In the main menu"
|
||||
}
|
||||
},
|
||||
"player": {
|
||||
"max_velocity": 3,
|
||||
"acceleration": 2,
|
||||
"deceleration": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ use nalgebra as na;
|
||||
pub struct Player {
|
||||
pub position: na::Vector2<f32>,
|
||||
pub velocity: na::Vector2<f32>,
|
||||
pub size: f32,
|
||||
}
|
||||
|
||||
impl Player {
|
||||
@ -14,7 +15,8 @@ impl Player {
|
||||
Self {
|
||||
position,
|
||||
velocity: na::Vector2::zeros(),
|
||||
size: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,20 @@ pub struct DiscordConstants {
|
||||
pub strings: HashMap<String, String>,
|
||||
}
|
||||
|
||||
/// Constants relating to the Player
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct PlayerConstants {
|
||||
|
||||
/// Maximum velocity, tiles per second
|
||||
pub max_velocity: u32,
|
||||
|
||||
/// Acceleration, tiles per second per second
|
||||
pub acceleration: u32,
|
||||
|
||||
/// Deceleration, tiles per second per second
|
||||
pub deceleration: u32,
|
||||
}
|
||||
|
||||
/// This structure is filled with the contents of `dist/project-constants.json` at runtime
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ProjectConstants {
|
||||
@ -40,6 +54,12 @@ pub struct ProjectConstants {
|
||||
/// The Discord constants
|
||||
pub discord: DiscordConstants,
|
||||
|
||||
/// The Player constants
|
||||
pub player: PlayerConstants,
|
||||
|
||||
/// The target framerate of the game
|
||||
pub target_fps: u32,
|
||||
|
||||
/// The size of the game tiles
|
||||
pub tile_size: u32,
|
||||
}
|
||||
|
@ -65,13 +65,11 @@ impl SceneRenderDelegate {
|
||||
// Render the main menu if in it, otherwise, render the game
|
||||
match self.menu_control_signal {
|
||||
MenuStateSignal::StartGame => {
|
||||
// self.scene_playable
|
||||
// .render_frame(raylib, rl_thread, &discord, global_resources, constants)
|
||||
// .await;
|
||||
|
||||
// TODO: remove this test scene
|
||||
self.scene_test_fox
|
||||
.render_frame(raylib, rl_thread, &discord, global_resources)
|
||||
self.scene_playable
|
||||
.render_frame(raylib, rl_thread, &discord, global_resources, constants)
|
||||
.await;
|
||||
self.scene_playable
|
||||
.update_physics(raylib, constants)
|
||||
.await;
|
||||
}
|
||||
MenuStateSignal::QuitGame => unimplemented!(),
|
||||
|
@ -2,39 +2,60 @@
|
||||
|
||||
use nalgebra as na;
|
||||
use raylib::prelude::*;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use crate::{
|
||||
discord::{DiscordChannel, DiscordRpcSignal},
|
||||
global_resource_package::GlobalResources,
|
||||
model::player::Player,
|
||||
project_constants::ProjectConstants,
|
||||
rendering::utilities::anim_texture::AnimatedTexture,
|
||||
rendering::utilities::{anim_texture::AnimatedTexture, map_render::MapRenderer},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PlayableScene {
|
||||
has_updated_discord_rpc: bool,
|
||||
player: Player,
|
||||
world_map: MapRenderer,
|
||||
camera: raylib::camera::Camera2D,
|
||||
last_update: SystemTime,
|
||||
}
|
||||
|
||||
impl PlayableScene {
|
||||
/// Construct a new `PlayableScene`
|
||||
pub fn new(
|
||||
raylib_handle: &mut RaylibHandle,
|
||||
thread: &RaylibThread,
|
||||
raylib_handle: &mut raylib::RaylibHandle,
|
||||
thread: & raylib::RaylibThread,
|
||||
constants: &ProjectConstants,
|
||||
) -> Self {
|
||||
|
||||
let map_renderer = MapRenderer::new("map_gameMap.tmx", raylib_handle, thread).unwrap();
|
||||
|
||||
Self {
|
||||
has_updated_discord_rpc: false,
|
||||
player: Player::new(na::Vector2::new(10.0, 10.0)),
|
||||
world_map: map_renderer,
|
||||
camera: raylib::camera::Camera2D {
|
||||
target: raylib::math::Vector2 {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
},
|
||||
offset: raylib::math::Vector2 {
|
||||
x: (constants.base_window_size.0 as f32 / 2.0),
|
||||
y: (constants.base_window_size.1 as f32 / 2.0)
|
||||
},
|
||||
rotation: 0.0,
|
||||
zoom: 1.0
|
||||
},
|
||||
last_update: SystemTime::UNIX_EPOCH
|
||||
}
|
||||
}
|
||||
|
||||
/// Handler for each frame
|
||||
pub async fn render_frame(
|
||||
&mut self,
|
||||
raylib: &mut RaylibHandle,
|
||||
rl_thread: &RaylibThread,
|
||||
raylib: &mut raylib::RaylibHandle,
|
||||
rl_thread: &raylib::RaylibThread,
|
||||
discord: &DiscordChannel,
|
||||
global_resources: &GlobalResources,
|
||||
constants: &ProjectConstants,
|
||||
@ -61,7 +82,79 @@ impl PlayableScene {
|
||||
// Clear the screen
|
||||
draw.clear_background(Color::WHITE);
|
||||
|
||||
// TODO: Render stuff
|
||||
// self.player. <whatever>
|
||||
{
|
||||
// Begin camera mode
|
||||
let mut ctx2d = draw.begin_mode2D(self.camera);
|
||||
|
||||
// Render the map
|
||||
self.world_map.render_map(&mut ctx2d, &self.camera, true);
|
||||
}
|
||||
|
||||
for i in 0..100 {
|
||||
for j in 0..100 {
|
||||
draw.draw_rectangle(
|
||||
constants.tile_size as i32 * (i * 2),
|
||||
constants.tile_size as i32 * (j * 2) * -1,
|
||||
constants.tile_size as i32,
|
||||
constants.tile_size as i32,
|
||||
Color::RED
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
draw.draw_rectangle(
|
||||
self.player.position[0] as i32,
|
||||
self.player.position[1] as i32 * -1,
|
||||
(constants.tile_size as f32 * self.player.size) as i32,
|
||||
(constants.tile_size as f32 * self.player.size) as i32,
|
||||
Color::GREEN
|
||||
);
|
||||
}
|
||||
|
||||
// Physics
|
||||
pub async fn update_physics(
|
||||
&mut self,
|
||||
raylib: & raylib::RaylibHandle,
|
||||
constants: &ProjectConstants,
|
||||
) {
|
||||
|
||||
// Get time since last physics update
|
||||
let time = SystemTime::now();
|
||||
let elapsed = time.duration_since(self.last_update).expect("Time Appears to Have Moved Backwards!");
|
||||
self.last_update = time;
|
||||
let delta_time = elapsed.as_millis() as f32 / 1000.0; // Physics will be scaled by this value
|
||||
|
||||
let player = &mut self.player;
|
||||
|
||||
// Get input direction components
|
||||
let h_axis = raylib.is_key_down(KeyboardKey::KEY_D) as i8 - raylib.is_key_down(KeyboardKey::KEY_A) as i8;
|
||||
let v_axis = raylib.is_key_down(KeyboardKey::KEY_W) as i8 - raylib.is_key_down(KeyboardKey::KEY_S) as i8;
|
||||
if h_axis != 0 || v_axis != 0 {
|
||||
// Normalize input and accelerate in desired direction
|
||||
let direction = na::Vector2::new(h_axis as f32, v_axis as f32).normalize();
|
||||
player.velocity += &direction.xy()
|
||||
* constants.player.acceleration as f32
|
||||
* constants.tile_size as f32
|
||||
* delta_time;
|
||||
}
|
||||
|
||||
if player.velocity.magnitude() != 0.0 {
|
||||
player.velocity -= player.velocity.normalize()
|
||||
* constants.player.deceleration as f32
|
||||
* constants.tile_size as f32
|
||||
* delta_time;
|
||||
if player.velocity.magnitude() < 0.01 {
|
||||
player.velocity.set_magnitude(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((constants.player.max_velocity * constants.tile_size) as f32)
|
||||
< player.velocity.magnitude() {
|
||||
player.velocity.set_magnitude((constants.player.max_velocity * constants.tile_size) as f32);
|
||||
}
|
||||
|
||||
player.position += &player.velocity * delta_time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|