Skip to content

Commit

Permalink
Move the starting grid into the tiled data.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-thompson committed Feb 5, 2024
1 parent 9385bc8 commit 2172770
Show file tree
Hide file tree
Showing 11 changed files with 517 additions and 209 deletions.
216 changes: 215 additions & 1 deletion src/assets/level1.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="38" height="24" tilewidth="128" tileheight="128" infinite="0" backgroundcolor="#27ae60" nextlayerid="9" nextobjectid="1">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="38" height="24" tilewidth="128" tileheight="128" infinite="0" backgroundcolor="#27ae60" nextlayerid="10" nextobjectid="25">
<tileset firstgid="1" name="Grass" tilewidth="128" tileheight="128" tilecount="14" columns="0">
<grid orientation="orthogonal" width="1" height="1"/>
<tile id="0">
Expand Down Expand Up @@ -636,6 +636,204 @@
<image width="128" height="128" source="kenney_racing-pack/PNG/Tiles/Dirt/land_dirt14.png"/>
</tile>
</tileset>
<tileset firstgid="209" name="Objects" tilewidth="448" tileheight="256" tilecount="39" columns="0">
<grid orientation="orthogonal" width="1" height="1"/>
<tile id="0">
<image width="165" height="99" source="kenney_racing-pack/PNG/Objects/arrow_white.png"/>
</tile>
<tile id="1">
<image width="165" height="99" source="kenney_racing-pack/PNG/Objects/arrow_yellow.png"/>
</tile>
<tile id="2">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/barrel_blue.png"/>
</tile>
<tile id="3">
<image width="70" height="48" source="kenney_racing-pack/PNG/Objects/barrel_blue_down.png"/>
</tile>
<tile id="4">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/barrel_red.png"/>
</tile>
<tile id="5">
<image width="70" height="48" source="kenney_racing-pack/PNG/Objects/barrel_red_down.png"/>
</tile>
<tile id="6">
<image width="210" height="62" source="kenney_racing-pack/PNG/Objects/barrier_red.png"/>
</tile>
<tile id="7">
<image width="210" height="62" source="kenney_racing-pack/PNG/Objects/barrier_red_race.png"/>
</tile>
<tile id="8">
<image width="210" height="62" source="kenney_racing-pack/PNG/Objects/barrier_white.png"/>
</tile>
<tile id="9">
<image width="210" height="62" source="kenney_racing-pack/PNG/Objects/barrier_white_race.png"/>
</tile>
<tile id="10">
<image width="46" height="44" source="kenney_racing-pack/PNG/Objects/cone_down.png"/>
</tile>
<tile id="11">
<image width="45" height="44" source="kenney_racing-pack/PNG/Objects/cone_straight.png"/>
</tile>
<tile id="12">
<image width="160" height="64" source="kenney_racing-pack/PNG/Objects/lights.png"/>
</tile>
<tile id="13">
<image width="98" height="235" source="kenney_racing-pack/PNG/Objects/light_white.png"/>
</tile>
<tile id="14">
<image width="98" height="235" source="kenney_racing-pack/PNG/Objects/light_yellow.png"/>
</tile>
<tile id="15">
<image width="109" height="95" source="kenney_racing-pack/PNG/Objects/oil.png"/>
</tile>
<tile id="16">
<image width="89" height="72" source="kenney_racing-pack/PNG/Objects/rock1.png"/>
</tile>
<tile id="17">
<image width="73" height="68" source="kenney_racing-pack/PNG/Objects/rock2.png"/>
</tile>
<tile id="18">
<image width="87" height="67" source="kenney_racing-pack/PNG/Objects/rock3.png"/>
</tile>
<tile id="19">
<image width="60" height="192" source="kenney_racing-pack/PNG/Objects/skidmark_long_1.png"/>
</tile>
<tile id="20">
<image width="60" height="192" source="kenney_racing-pack/PNG/Objects/skidmark_long_2.png"/>
</tile>
<tile id="21">
<image width="76" height="192" source="kenney_racing-pack/PNG/Objects/skidmark_long_3.png"/>
</tile>
<tile id="22">
<image width="60" height="16" source="kenney_racing-pack/PNG/Objects/skidmark_short_1.png"/>
</tile>
<tile id="23">
<image width="60" height="16" source="kenney_racing-pack/PNG/Objects/skidmark_short_2.png"/>
</tile>
<tile id="24">
<image width="76" height="16" source="kenney_racing-pack/PNG/Objects/skidmark_short_3.png"/>
</tile>
<tile id="25">
<image width="128" height="128" source="kenney_racing-pack/PNG/Objects/tent_blue.png"/>
</tile>
<tile id="26">
<image width="256" height="256" source="kenney_racing-pack/PNG/Objects/tent_blue_large.png"/>
</tile>
<tile id="27">
<image width="128" height="128" source="kenney_racing-pack/PNG/Objects/tent_red.png"/>
</tile>
<tile id="28">
<image width="256" height="256" source="kenney_racing-pack/PNG/Objects/tent_red_large.png"/>
</tile>
<tile id="29">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/tires_red.png"/>
</tile>
<tile id="30">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/tires_red_alt.png"/>
</tile>
<tile id="31">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/tires_white.png"/>
</tile>
<tile id="32">
<image width="56" height="56" source="kenney_racing-pack/PNG/Objects/tires_white_alt.png"/>
</tile>
<tile id="33">
<image width="214" height="212" source="kenney_racing-pack/PNG/Objects/tree_large.png"/>
</tile>
<tile id="34">
<image width="141" height="141" source="kenney_racing-pack/PNG/Objects/tree_small.png"/>
</tile>
<tile id="35">
<image width="448" height="223" source="kenney_racing-pack/PNG/Objects/tribune_empty.png"/>
</tile>
<tile id="36">
<image width="448" height="223" source="kenney_racing-pack/PNG/Objects/tribune_full.png"/>
</tile>
<tile id="37">
<image width="448" height="144" source="kenney_racing-pack/PNG/Objects/tribune_overhang_red.png"/>
</tile>
<tile id="38">
<image width="448" height="144" source="kenney_racing-pack/PNG/Objects/tribune_overhang_striped.png"/>
</tile>
</tileset>
<tileset firstgid="248" name="Vehicles" tilewidth="71" tileheight="131" tilecount="25" columns="0">
<grid orientation="orthogonal" width="1" height="1"/>
<tile id="0">
<image width="71" height="131" source="kenney_racing-pack/PNG/Cars/car_black_1.png"/>
</tile>
<tile id="1">
<image width="71" height="116" source="kenney_racing-pack/PNG/Cars/car_black_2.png"/>
</tile>
<tile id="2">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_black_3.png"/>
</tile>
<tile id="3">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_black_4.png"/>
</tile>
<tile id="4">
<image width="70" height="121" source="kenney_racing-pack/PNG/Cars/car_black_5.png"/>
</tile>
<tile id="5">
<image width="71" height="131" source="kenney_racing-pack/PNG/Cars/car_blue_1.png"/>
</tile>
<tile id="6">
<image width="71" height="116" source="kenney_racing-pack/PNG/Cars/car_blue_2.png"/>
</tile>
<tile id="7">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_blue_3.png"/>
</tile>
<tile id="8">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_blue_4.png"/>
</tile>
<tile id="9">
<image width="70" height="121" source="kenney_racing-pack/PNG/Cars/car_blue_5.png"/>
</tile>
<tile id="10">
<image width="71" height="131" source="kenney_racing-pack/PNG/Cars/car_green_1.png"/>
</tile>
<tile id="11">
<image width="71" height="116" source="kenney_racing-pack/PNG/Cars/car_green_2.png"/>
</tile>
<tile id="12">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_green_3.png"/>
</tile>
<tile id="13">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_green_4.png"/>
</tile>
<tile id="14">
<image width="70" height="121" source="kenney_racing-pack/PNG/Cars/car_green_5.png"/>
</tile>
<tile id="15">
<image width="71" height="131" source="kenney_racing-pack/PNG/Cars/car_red_1.png"/>
</tile>
<tile id="16">
<image width="71" height="116" source="kenney_racing-pack/PNG/Cars/car_red_2.png"/>
</tile>
<tile id="17">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_red_3.png"/>
</tile>
<tile id="18">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_red_4.png"/>
</tile>
<tile id="19">
<image width="70" height="121" source="kenney_racing-pack/PNG/Cars/car_red_5.png"/>
</tile>
<tile id="20">
<image width="71" height="131" source="kenney_racing-pack/PNG/Cars/car_yellow_1.png"/>
</tile>
<tile id="21">
<image width="71" height="116" source="kenney_racing-pack/PNG/Cars/car_yellow_2.png"/>
</tile>
<tile id="22">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_yellow_3.png"/>
</tile>
<tile id="23">
<image width="70" height="131" source="kenney_racing-pack/PNG/Cars/car_yellow_4.png"/>
</tile>
<tile id="24">
<image width="70" height="121" source="kenney_racing-pack/PNG/Cars/car_yellow_5.png"/>
</tile>
</tileset>
<layer id="2" name="Background" width="38" height="24">
<data encoding="csv">
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
Expand Down Expand Up @@ -692,4 +890,20 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="9" name="Objects">
<object id="1" gid="242" x="2923.3" y="1212.06" width="214" height="212"/>
<object id="2" gid="243" x="3005.76" y="1016.45" width="141" height="141"/>
<object id="3" gid="245" x="1403.27" y="1136" width="448" height="223"/>
<object id="4" gid="245" x="1882.06" y="1136" width="448" height="223"/>
<object id="6" gid="241" x="2627.55" y="1138.09" width="56" height="56"/>
<object id="7" gid="241" x="2627.55" y="1071.42" width="56" height="56"/>
<object id="8" gid="241" x="2563.91" y="1138.09" width="56" height="56"/>
<object id="10" gid="215" x="2064.7" y="2252.21" width="210" height="62"/>
<object id="11" gid="215" x="2313.18" y="2252.21" width="210" height="62"/>
<object id="15" gid="242" x="2993" y="1390.85" width="214" height="212"/>
<object id="17" gid="261" x="2047.12" y="1195.39" width="70" height="131" rotation="90"/>
<object id="18" gid="267" x="1926.64" y="1300.33" width="70" height="121" rotation="90"/>
<object id="19" gid="270" x="2172.27" y="1302.3" width="70" height="131" rotation="90"/>
<object id="20" gid="253" x="2297.42" y="1195.33" width="71" height="131" rotation="90"/>
</objectgroup>
</map>
25 changes: 23 additions & 2 deletions src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,31 @@ impl bevy::prelude::Plugin for Plugin {
embedded_asset!(app, p, "speeddial.png");
embedded_asset!(app, p, "speedneedle.png");

racepack_png!(app, p, "Cars/car_red_5.png");
racepack_png!(app, p, "Cars/car_black_1.png");
racepack_png!(app, p, "Cars/car_black_2.png");
racepack_png!(app, p, "Cars/car_black_3.png");
racepack_png!(app, p, "Cars/car_black_4.png");
racepack_png!(app, p, "Cars/car_black_5.png");
racepack_png!(app, p, "Cars/car_blue_1.png");
racepack_png!(app, p, "Cars/car_yellow_3.png");
racepack_png!(app, p, "Cars/car_blue_2.png");
racepack_png!(app, p, "Cars/car_blue_3.png");
racepack_png!(app, p, "Cars/car_blue_4.png");
racepack_png!(app, p, "Cars/car_blue_5.png");
racepack_png!(app, p, "Cars/car_green_1.png");
racepack_png!(app, p, "Cars/car_green_2.png");
racepack_png!(app, p, "Cars/car_green_3.png");
racepack_png!(app, p, "Cars/car_green_4.png");
racepack_png!(app, p, "Cars/car_green_5.png");
racepack_png!(app, p, "Cars/car_red_1.png");
racepack_png!(app, p, "Cars/car_red_2.png");
racepack_png!(app, p, "Cars/car_red_3.png");
racepack_png!(app, p, "Cars/car_red_4.png");
racepack_png!(app, p, "Cars/car_red_5.png");
racepack_png!(app, p, "Cars/car_yellow_1.png");
racepack_png!(app, p, "Cars/car_yellow_2.png");
racepack_png!(app, p, "Cars/car_yellow_3.png");
racepack_png!(app, p, "Cars/car_yellow_4.png");
racepack_png!(app, p, "Cars/car_yellow_5.png");

racepack_png!(app, p, "Objects/arrow_white.png");
racepack_png!(app, p, "Objects/arrow_yellow.png");
Expand Down
5 changes: 4 additions & 1 deletion src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ fn update_speedo(
player: Query<(&physics::Velocity, With<Player>)>,
mut speedo: Query<(&mut Transform, With<Speedometer>)>,
) {
let (vp, _) = player.single();
let (vp, _) = match player.iter().next() {
Some(t) => t,
None => return,
};
let (mut needle, _) = speedo.single_mut();

needle.rotation = Quat::from_rotation_z(vp.0.length() / 100.0);
Expand Down
Loading

0 comments on commit 2172770

Please sign in to comment.