generated from trubusoft/bevy-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add AssetHandlerPlugin * alpha main menu skeleton * alpha title, play button, and quit button bundle * alpha play and quit button * title section * add button color change on interaction * add on button pressed * separate main menu code to main_menu.rs * update button hovered color * rename UiButton to UIButton and add run condition * add GameState::Stop when game over * alpha pause_menu.rs * simplify main menu * simplify pause menu * . * GameState::Stop * alpha game over menu * alpha hud * . * move update final score text to one time process on startup * fix CollidedWithEnemy being spawned twice * fix size
- Loading branch information
1 parent
506bf46
commit e6a66ee
Showing
11 changed files
with
1,085 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use bevy::prelude::{ | ||
App, AssetServer, AudioSource, Handle, Image, Plugin, Res, ResMut, Resource, Startup, | ||
}; | ||
|
||
#[derive(Resource, Debug, Default)] | ||
pub struct AssetHandler { | ||
pub player_texture: Handle<Image>, | ||
pub enemy_texture: Handle<Image>, | ||
pub star_texture: Handle<Image>, | ||
pub bounce_1_sound: Handle<AudioSource>, | ||
pub bounce_2_sound: Handle<AudioSource>, | ||
pub obtain_star_sound: Handle<AudioSource>, | ||
pub game_over_sound: Handle<AudioSource>, | ||
} | ||
|
||
pub struct AssetHandlerPlugin; | ||
impl Plugin for AssetHandlerPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.init_resource::<AssetHandler>() | ||
.add_systems(Startup, load_assets); | ||
} | ||
} | ||
|
||
fn load_assets(mut scene_assets: ResMut<AssetHandler>, asset_server: Res<AssetServer>) { | ||
scene_assets.player_texture = asset_server.load("sprites/ball_blue_large.png"); | ||
scene_assets.enemy_texture = asset_server.load("sprites/ball_red_large.png"); | ||
scene_assets.star_texture = asset_server.load("sprites/star.png"); | ||
scene_assets.bounce_1_sound = asset_server.load("audio/pluck_001.ogg"); | ||
scene_assets.bounce_2_sound = asset_server.load("audio/pluck_002.ogg"); | ||
scene_assets.obtain_star_sound = asset_server.load("audio/laserLarge_000.ogg"); | ||
scene_assets.game_over_sound = asset_server.load("audio/explosionCrunch_000.ogg"); | ||
|
||
// *scene_assets = SceneAssets { | ||
// player_texture: asset_server.load("sprites/ball_blue_large.png"), | ||
// enemy_texture: asset_server.load("sprites/ball_red_large.png"), | ||
// star_texture: asset_server.load("sprites/star.png"), | ||
// bounce_1_sound: asset_server.load("audio/pluck_001.ogg"), | ||
// bounce_2_sound: asset_server.load("audio/pluck_002.ogg"), | ||
// obtain_star_sound: asset_server.load("audio/laserLarge_000.ogg"), | ||
// game_over_sound: asset_server.load("audio/explosionCrunch_000.ogg"), | ||
// }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.