Skip to content

Commit

Permalink
main menu music
Browse files Browse the repository at this point in the history
  • Loading branch information
stillonearth committed Jan 6, 2024
1 parent ec6f691 commit 31f6ffa
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 46 deletions.
Binary file added assets/audio/mierda.ogg
Binary file not shown.
34 changes: 17 additions & 17 deletions src/entities/biboran.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct Biboran {
#[derive(Clone, Default, Bundle)]
pub struct BiboranBundle {
pub sprite_bundle: SpriteSheetBundle,
pub pizza: Biboran,
pub biboran: Biboran,
pub collider_bundle: ColliderBundle,
pub sensor: Sensor,
}
Expand Down Expand Up @@ -96,7 +96,7 @@ pub fn create_biboran_bundle(
BiboranBundle {
sprite_bundle,
collider_bundle,
pizza: Biboran { is_dummy },
biboran: Biboran { is_dummy },
sensor: Sensor {},
}
}
Expand Down Expand Up @@ -177,18 +177,18 @@ pub fn event_spawn_biboran(
.unwrap();

for _i in 0..ev_spawn.count {
for (pizza_entity, biboran_parent, pizza) in biborans.iter() {
for (biboran_entity, biboran_parent, pizza) in biborans.iter() {
if !pizza.is_dummy {
continue;
}

let pizza_parent = biboran_parent.get();
let biboran_parent = biboran_parent.get();

if parent_entity != pizza_parent {
if parent_entity != biboran_parent {
continue;
}

let mut parent = commands.entity(pizza_parent);
let mut parent = commands.entity(biboran_parent);

let mut new_entity: Option<Entity> = None;
parent.with_children(|cm| {
Expand Down Expand Up @@ -224,7 +224,7 @@ pub fn event_spawn_biboran(
.insert(Biboran { is_dummy: false });

commands.add(CloneEntity {
source: pizza_entity,
source: biboran_entity,
destination: new_entity,
});

Expand All @@ -239,7 +239,7 @@ pub fn event_spawn_biboran(
pub fn event_on_biboran_step_over(
mut commands: Commands,
mut er_biboran_step_over: EventReader<BiboranStepOverEvent>,
mut q_pizzas: Query<(Entity, &Biboran)>,
mut q_biborans: Query<(Entity, &Biboran)>,
mut q_player: Query<(Entity, &mut Player)>,
mut q_biboran_animations: Query<(&mut Visibility, &BiboranSprite)>, // mut q_ui_healthbar: Query<(Entity, &mut Style, &ui::UIPlayerHealth)>,
mut biboran_timer: ResMut<BiboranTimer>,
Expand Down Expand Up @@ -271,11 +271,11 @@ pub fn event_on_biboran_step_over(
player.play(animations.0.clone_weak()).repeat();
}

for (e_pizza, _) in q_pizzas.iter_mut() {
if e_pizza != e.0 {
for (e_biboran, _) in q_biborans.iter_mut() {
if e_biboran != e.0 {
continue;
}
commands.entity(e_pizza).despawn_recursive();
commands.entity(e_biboran).despawn_recursive();
}
}
}
Expand All @@ -286,21 +286,21 @@ pub fn event_on_biboran_step_over(

pub(crate) fn handle_player_biboran_collision(
mut collision_events: EventReader<CollisionEvent>,
mut q_pizzas: Query<(Entity, &Biboran)>,
mut q_q_biborans: Query<(Entity, &Biboran)>,
q_player: Query<(Entity, &mut Player)>,
mut ev_biboran_step_over: EventWriter<BiboranStepOverEvent>,
) {
for (player_entity, _) in q_player.iter() {
for event in collision_events.iter() {
for (e_pizza, _) in q_pizzas.iter_mut() {
for (e_biboran, _) in q_q_biborans.iter_mut() {
if let CollisionEvent::Started(e1, e2, _) = event {
if e1.index() == e_pizza.index() && e2.index() == player_entity.index() {
ev_biboran_step_over.send(BiboranStepOverEvent(e_pizza));
if e1.index() == e_biboran.index() && e2.index() == player_entity.index() {
ev_biboran_step_over.send(BiboranStepOverEvent(e_biboran));
return;
}

if e2.index() == e_pizza.index() && e1.index() == player_entity.index() {
ev_biboran_step_over.send(BiboranStepOverEvent(e_pizza));
if e2.index() == e_biboran.index() && e1.index() == player_entity.index() {
ev_biboran_step_over.send(BiboranStepOverEvent(e_biboran));
return;
}
}
Expand Down
60 changes: 31 additions & 29 deletions src/gameplay/waves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,37 +228,39 @@ pub fn ui_wave_info_text(
pub fn get_level_1_waves() -> Vec<Wave> {
vec![
Wave {
events: vec![
WaveEntry::Biboran { count: 10 },
// WaveEntry::Mierda { count: 15 },
],
events: vec![WaveEntry::Mierda { count: 15 }],
event_duration: Duration::from_secs(10),
wave_duration: Duration::from_secs(30),
},
// Wave {
// events: vec![
// WaveEntry::Mierda { count: 100 },
// WaveEntry::Mierda { count: 100 },
// WaveEntry::Mierda { count: 100 },
// ],
// event_duration: Duration::from_secs(20),
// wave_duration: Duration::from_secs(60),
// },
// Wave {
// events: vec![
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Pizza { count: 3 },
// ],
// event_duration: Duration::from_secs(20),
// wave_duration: Duration::from_secs(200),
// },
Wave {
events: vec![
WaveEntry::Mierda { count: 100 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Mierda { count: 100 },
WaveEntry::Biboran { count: 1 },
WaveEntry::Mierda { count: 100 },
],
event_duration: Duration::from_secs(20),
wave_duration: Duration::from_secs(80),
},
Wave {
events: vec![
WaveEntry::Mierda { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Mierda { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Biboran { count: 1 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Mierda { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Biboran { count: 1 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Biboran { count: 1 },
WaveEntry::Pizza { count: 3 },
],
event_duration: Duration::from_secs(20),
wave_duration: Duration::from_secs(260),
},
]
}
2 changes: 2 additions & 0 deletions src/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ impl Plugin for LoadingPlugin {
pub struct AudioAssets {
#[asset(path = "audio/biboran.ogg")]
pub biboran: Handle<AudioSource>,
#[asset(path = "audio/mierda.ogg")]
pub mierda: Handle<AudioSource>,
}

#[derive(AssetCollection, Resource)]
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use cutscene::*;
use loading::*;
use menu::*;

mod audio;
mod controls;
mod cutscene;
mod entities;
Expand Down Expand Up @@ -70,6 +71,7 @@ fn main() {
.add_plugins(HookPlugin)
.add_plugins(LoadingPlugin)
.add_plugins(MenuPlugin)
.add_plugins(audio::InternalAudioPlugin)
.add_plugins(CutscenePlugin)
.add_plugins(PecsPlugin)
.add_plugins(
Expand Down

0 comments on commit 31f6ffa

Please sign in to comment.