mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-05 21:15:39 -06:00
refactor: remove unused component, simplify visibility check defaulting behavior, reformat STORY.md
This commit is contained in:
2
STORY.md
2
STORY.md
@@ -412,8 +412,8 @@ The bigger downside was that I had to toss out almost all the existing code for
|
||||
|
||||
This ended up being okay though, as I was able to clean up a lot of gross code, and the system ended up being easier to work with by comparison.
|
||||
|
||||
[code-review-video]: https://www.youtube.com/watch?v=OKs_JewEeOo
|
||||
[code-review-thumbnail]: https://img.youtube.com/vi/OKs_JewEeOo/hqdefault.jpg
|
||||
[code-review-video]: https://www.youtube.com/watch?v=OKs_JewEeOo
|
||||
[fighting-lifetimes-1]: https://devcry.heiho.net/html/2022/20220709-rust-and-sdl2-fighting-with-lifetimes.html
|
||||
[fighting-lifetimes-2]: https://devcry.heiho.net/html/2022/20220716-rust-and-sdl2-fighting-with-lifetimes-2.html
|
||||
[fighting-lifetimes-3]: https://devcry.heiho.net/html/2022/20220724-rust-and-sdl2-fighting-with-lifetimes-3.html
|
||||
|
||||
@@ -175,11 +175,6 @@ impl Map {
|
||||
remaining_distance: distance / 2.0,
|
||||
};
|
||||
|
||||
tracing::warn!(
|
||||
fruit_spawn_position = ?fruit_spawn_position,
|
||||
"Fruit spawn position found"
|
||||
);
|
||||
|
||||
let start_positions = NodePositions {
|
||||
pacman: grid_to_node[&start_pos],
|
||||
blinky: house_entrance_node_id,
|
||||
|
||||
@@ -22,10 +22,6 @@ use bevy_ecs::system::{Commands, Query, Res};
|
||||
use rand::seq::IndexedRandom;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
/// Tag component for eaten ghosts
|
||||
#[derive(Component, Debug, Clone, Copy)]
|
||||
pub struct Eaten;
|
||||
|
||||
/// Tag component for Pac-Man during his death animation.
|
||||
/// This is mainly because the Frozen tag would stop both movement and animation, while the Dying tag can signal that the animation should continue despite being frozen.
|
||||
#[derive(Component, Debug, Clone, Copy)]
|
||||
|
||||
@@ -146,7 +146,7 @@ pub fn render_system(
|
||||
// Collect and filter visible entities, then sort by layer
|
||||
let mut visible_entities: Vec<_> = renderables
|
||||
.iter()
|
||||
.filter(|(_, _, _, _, visibility)| visibility.map(|v| v.is_visible()).unwrap_or(true))
|
||||
.filter(|(_, _, _, _, visibility)| visibility.copied().unwrap_or_default().is_visible())
|
||||
.collect();
|
||||
|
||||
visible_entities.sort_by_key(|(_, renderable, _, _, _)| renderable.layer);
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::systems::SpawnTrigger;
|
||||
use crate::{
|
||||
map::builder::Map,
|
||||
systems::{
|
||||
AudioEvent, Blinking, DirectionalAnimation, Dying, Eaten, Frozen, Ghost, GhostCollider, GhostState, LinearAnimation,
|
||||
Looping, NodeId, PlayerControlled, Position, Visibility,
|
||||
AudioEvent, Blinking, DirectionalAnimation, Dying, Frozen, Ghost, GhostCollider, GhostState, LinearAnimation, Looping,
|
||||
NodeId, PlayerControlled, Position, Visibility,
|
||||
},
|
||||
};
|
||||
use bevy_ecs::{
|
||||
@@ -296,7 +296,7 @@ pub fn stage_system(
|
||||
};
|
||||
commands
|
||||
.entity(ghost_entity)
|
||||
.remove::<(Frozen, Eaten)>()
|
||||
.remove::<Frozen>()
|
||||
.insert((Visibility::visible(), GhostState::Normal));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user