diff --git a/src/audio.rs b/src/audio.rs new file mode 100644 index 0000000..cba4e3a --- /dev/null +++ b/src/audio.rs @@ -0,0 +1,13 @@ +use bevy::prelude::*; + +pub struct AudioPlugin; + +impl Plugin for AudioPlugin { + fn build(&self, app: &mut App) { + app.add_systems(Startup, load_audio); + } +} + +fn load_audio(assets: Res, mut commands: Commands) { + commands.spawn(AudioPlayer::new(assets.load("its-the-balatro-music.ogg"))); +} diff --git a/src/deck.rs b/src/deck.rs index ee52942..31bf2c7 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -124,16 +124,14 @@ impl Card { }; (3 * shape_col) + number_col }; - info!("Row: {:?} Col: {:?}", row, col); - assert!(row < 12); - assert!(row > 2); - assert!(col < 9); + assert!(row < 12, "Sprite row should be less than 12"); + assert!(row > 2, "sprite row should be greater than 2"); + assert!(col < 9, "Sprite column should be less than 9"); // Figure out the sprite number based on row + col (9 * row) + col }; - info!("Index: {:?}", num); - assert!(num < 108); + assert!(num < 108, "Sprite index should be less than 108"); let size = UVec2 { x: 20, y: 32 }; let layout = TextureAtlasLayout::from_grid(size, 9, 12, None, None); diff --git a/src/main.rs b/src/main.rs index 8e87c6f..731d2d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +mod audio; mod boot; mod debug; mod deck; @@ -24,13 +25,17 @@ fn main() { }), ) .add_plugins(( - view::ViewPlugin, - deck::DeckPlugin, + audio::AudioPlugin, boot::BootPlugin, - setup::SetupPlugin, - play::PlayPlugin, menu::MenuPlugin, - debug::DebugPlugin, + play::PlayPlugin, + setup::SetupPlugin, + view::ViewPlugin, + deck::DeckPlugin, + { + #[cfg(debug_assertions)] + debug::DebugPlugin + }, )) .init_state::() .run(); diff --git a/todo.txt b/todo.txt index eb6a75e..84c1113 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,6 @@ TODO: * Better shuffling * Make "set" button visually interesting when 3 cards selected -* Use Animation for rotating cards * Animate cards deck -> board * Animate cards deck -> set-pile