mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-11 06:08:02 -06:00
chore: increase speed, no modulation, increase animation speed
This commit is contained in:
@@ -34,11 +34,11 @@ impl Pacman<'_> {
|
|||||||
position: Map::cell_to_pixel(starting_position),
|
position: Map::cell_to_pixel(starting_position),
|
||||||
direction: Direction::Right,
|
direction: Direction::Right,
|
||||||
next_direction: None,
|
next_direction: None,
|
||||||
speed: 2,
|
speed: 3,
|
||||||
map,
|
map,
|
||||||
stopped: false,
|
stopped: false,
|
||||||
modulation: SimpleTickModulator::new(0.9333),
|
modulation: SimpleTickModulator::new(1.0),
|
||||||
sprite: AnimatedTexture::new(atlas, 4, 3, 32, 32, Some((-4, -4))),
|
sprite: AnimatedTexture::new(atlas, 2, 3, 32, 32, Some((-4, -4))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +77,11 @@ impl Pacman<'_> {
|
|||||||
self.next_direction = None;
|
self.next_direction = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn internal_position_even(&self) -> (u32, u32) {
|
||||||
|
let (x, y ) = self.internal_position();
|
||||||
|
((x / 2u32) * 2u32, (y / 2u32) * 2u32)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Entity for Pacman<'_> {
|
impl Entity for Pacman<'_> {
|
||||||
@@ -104,7 +109,7 @@ impl Entity for Pacman<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn tick(&mut self) {
|
fn tick(&mut self) {
|
||||||
let can_change = self.internal_position() == (0, 0);
|
let can_change = self.internal_position_even() == (0, 0);
|
||||||
|
|
||||||
if can_change {
|
if can_change {
|
||||||
self.handle_requested_direction();
|
self.handle_requested_direction();
|
||||||
@@ -120,7 +125,7 @@ impl Entity for Pacman<'_> {
|
|||||||
self.stopped = false;
|
self.stopped = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.stopped && self.modulation.next() {
|
if !self.stopped && self.modulation.next() {
|
||||||
let speed = self.speed as i32;
|
let speed = self.speed as i32;
|
||||||
match self.direction {
|
match self.direction {
|
||||||
|
|||||||
Reference in New Issue
Block a user