mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-08 12:07:52 -06:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86ffc931e8 | |||
| d72f47d66c |
@@ -162,13 +162,18 @@ impl Moving for MovableEntity {
|
|||||||
let at_left_tunnel = x == 0;
|
let at_left_tunnel = x == 0;
|
||||||
let at_right_tunnel = x == BOARD_CELL_SIZE.x - 1;
|
let at_right_tunnel = x == BOARD_CELL_SIZE.x - 1;
|
||||||
|
|
||||||
|
// Reset tunnel state if we're not at a tunnel position
|
||||||
if !at_left_tunnel && !at_right_tunnel {
|
if !at_left_tunnel && !at_right_tunnel {
|
||||||
|
self.in_tunnel = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're already in a tunnel, stay in tunnel state
|
||||||
if self.in_tunnel {
|
if self.in_tunnel {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enter the tunnel and teleport to the other side
|
||||||
let new_x = if at_left_tunnel { BOARD_CELL_SIZE.x - 2 } else { 1 };
|
let new_x = if at_left_tunnel { BOARD_CELL_SIZE.x - 2 } else { 1 };
|
||||||
self.base.cell_position.x = new_x;
|
self.base.cell_position.x = new_x;
|
||||||
self.base.pixel_position = Map::cell_to_pixel(self.base.cell_position);
|
self.base.pixel_position = Map::cell_to_pixel(self.base.cell_position);
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ impl Game {
|
|||||||
Rc::clone(&map),
|
Rc::clone(&map),
|
||||||
)));
|
)));
|
||||||
let blinky = Blinky::new(UVec2::new(13, 11), Rc::clone(&atlas), Rc::clone(&map), Rc::clone(&pacman));
|
let blinky = Blinky::new(UVec2::new(13, 11), Rc::clone(&atlas), Rc::clone(&map), Rc::clone(&pacman));
|
||||||
let map_texture = get_atlas_tile(&atlas, "maze/full.png");
|
let mut map_texture = get_atlas_tile(&atlas, "maze/full.png");
|
||||||
|
map_texture.color = Some(Color::RGB(0x20, 0x20, 0xf9));
|
||||||
|
|
||||||
let edibles = reconstruct_edibles(
|
let edibles = reconstruct_edibles(
|
||||||
Rc::clone(&map),
|
Rc::clone(&map),
|
||||||
AnimatedTexture::new(vec![get_atlas_tile(&atlas, "maze/pellet.png")], 0),
|
AnimatedTexture::new(vec![get_atlas_tile(&atlas, "maze/pellet.png")], 0),
|
||||||
|
|||||||
Reference in New Issue
Block a user