Skip to content

Commit

Permalink
New notifications, release check
Browse files Browse the repository at this point in the history
  • Loading branch information
xill47 committed Apr 9, 2023
1 parent 4f058a9 commit 191e5cc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/levels/level_transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ pub fn level_transition(
for finish in finish_q.iter() {
if let Some(next_level) = &finish.next_level {
*level_selection = next_level.clone();
// reset_level_event.send(ResetLevelEvent);
info!("Next level: {:?}", level_selection);
}
}
for (entity, &background_color) in screen_q.iter_mut() {
Expand Down
16 changes: 12 additions & 4 deletions src/levels/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,18 @@ pub fn step_on_panel(
for (panel_coord, mut panel, mut image, mut sprite) in panel_q.iter_mut() {
for (player_coords, mut forbidden_movement) in player_q.iter_mut() {
if panel_coord == player_coords {
notify.send(Notification {
text: "You stepped on a panel!".into(),
duration: Duration::from_secs(2),
});
if let Some(laser) = panel.opens_laser {
notify.send(Notification {
text: format!("{} laser deactivated!", laser),
duration: Duration::from_secs_f32(1.2),
});
}
if !panel.forbids_movement.is_empty() || !panel.multi_movement.is_empty() {
notify.send(Notification {
text: "You feel like something has changed...".to_owned(),
duration: Duration::from_secs(2),
});
}
panel.active = true;
if let Some((atlas, new_sprite)) =
sprite_for_panel(&panel, &sprites.plates, &aseprites, &texture_atlases)
Expand Down
12 changes: 12 additions & 0 deletions src/levels/tiles.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Display;

use bevy::prelude::{Bundle, Component};
use bevy_ecs_ldtk::{
prelude::{LayerInstance, LdtkIntCell},
Expand Down Expand Up @@ -43,6 +45,16 @@ pub enum LaserType {
Blue,
}

impl Display for LaserType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
LaserType::Red => write!(f, "Red"),
LaserType::Green => write!(f, "Green"),
LaserType::Blue => write!(f, "Blue"),
}
}
}

#[derive(Bundle)]
pub struct DoorBundle {
pub door: Laser,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn add_notifications_ui(child_builder: &mut ChildBuilder, text_style: &TextS
align_items: AlignItems::Center,
..default()
},
background_color: BackgroundColor(Color::rgba(0.1, 0.1, 0.1, 0.5)),
background_color: BackgroundColor(Color::rgba(0.0, 0.0, 0.0, 0.5)),
..default()
})
.with_children(|parent| {
Expand Down

0 comments on commit 191e5cc

Please sign in to comment.