Skip to content

Commit

Permalink
remove unused assets
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanking90 committed Sep 17, 2024
1 parent e92cd40 commit dc31222
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 12 deletions.
Binary file added assets/.DS_Store
Binary file not shown.
Binary file removed assets/1085.png
Binary file not shown.
Binary file removed assets/1086.png
Binary file not shown.
Binary file removed assets/1087.png
Binary file not shown.
Binary file removed assets/1088.png
Binary file not shown.
Binary file removed assets/1089.png
Binary file not shown.
Binary file removed assets/1090.png
Binary file not shown.
Binary file removed assets/1091.png
Binary file not shown.
Binary file removed assets/1092.png
Binary file not shown.
Binary file removed assets/1093.png
Binary file not shown.
Binary file removed assets/1094.png
Binary file not shown.
Binary file removed assets/1095.png
Binary file not shown.
Binary file removed assets/1096.png
Binary file not shown.
Binary file removed assets/1097.png
Binary file not shown.
Binary file removed assets/1098.png
Binary file not shown.
Binary file removed assets/1099.png
Binary file not shown.
Binary file removed assets/1100.png
Binary file not shown.
Binary file removed assets/1101.png
Binary file not shown.
Binary file removed assets/1102.png
Binary file not shown.
Binary file removed assets/1103.png
Binary file not shown.
Binary file added assets/1145.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/1149.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/68.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions src/car.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,10 @@ pub enum CarState {

pub fn spawn_car(
mut commands: Commands,
asset_server: Res<AssetServer>,
window: Query<&Window>,
level_assets: Query<&LevelAssets>,
) {
let window_scale = 1080.0 / window.single().height();
let mut texture_list: Vec<Handle<Image>> = Vec::new();
for n in 0..20 {
texture_list.push(asset_server.load((1084 + n).to_string() + ".png"));
}

commands.spawn((
SpriteBundle {
Expand Down
28 changes: 23 additions & 5 deletions src/levels.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::car::*;
use crate::menu::*;
use crate::{car::*, menu::*, Background, Obstacle};
use crate::CameraMarker;
use bevy::prelude::*;

Expand Down Expand Up @@ -94,11 +93,12 @@ pub fn next_level(
pub fn load_level(
mut commands: Commands,
level: Res<Level>,
level_assets: Query<Entity, With<LevelAssets>>,
assets: Query<(Entity, AnyOf<(&LevelAssets, &Background, &Obstacle)>)>,
mut next_state: ResMut<NextState<GameState>>,
asset_server: Res<AssetServer>,

) {
level_assets.iter().for_each(|lvl| { commands.entity(lvl).despawn(); });
assets.iter().for_each(|a| { commands.entity(a.0).despawn(); });
match level.level {
1 => {
commands.spawn(LevelAssets {
Expand All @@ -119,7 +119,25 @@ pub fn load_level(
background_texture: asset_server.load("1058.png"),
});
}
2 => {}
2 => {
commands.spawn(LevelAssets {
obstacle_height: 291.0,
obstacle_width: 202.0,
obstacle_speed: 0.0,
obstacle_texture: vec![
asset_server.load("1149.png"),
asset_server.load("1149.png"),
],
y_values: [
(105.0 / 2.0 + 20.0),
(135.0 + 105.0 / 2.0 + 10.0),
(2.0 * 135.0 + 105.0 / 2.0 + 15.0),
(3.0 * 135.0 + 105.0 / 2.0 - 10.0),
],
car_texture: asset_server.load("1145.png"),
background_texture: asset_server.load("backroads.png"),
});
}
3 => {}
_ => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn main() {
//.add_plugins(WorldInspectorPlugin::new())
.add_systems(Startup, spawn_ui)
.add_systems(Startup, spawn_score)
.add_systems(Startup, spawn_menu)
//.add_systems(Startup, spawn_menu)
.add_systems(Update, update_menu)
.add_systems(Update, update_score.run_if(in_state(GameState::Running)))
.add_systems(Update, camera_tracking.run_if(in_state(GameState::Running)))
Expand All @@ -55,7 +55,7 @@ fn main() {
.add_systems(Update, load_level.run_if(in_state(GameState::LoadNextLevel)))

.add_systems(Update, update_background.run_if(in_state(GameState::Running)))
.add_systems(FixedUpdate, update_car.run_if(in_state(GameState::Running)))
.add_systems(Update, update_car.run_if(in_state(GameState::Running)))
.add_systems(Update, update_obstacles.run_if(in_state(GameState::Running)))
.add_systems(Update, spawn_new_obstacles.after(update_obstacles))
.add_systems(Update, detect_collision.run_if(in_state(GameState::Running)))
Expand Down

0 comments on commit dc31222

Please sign in to comment.