summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-22 02:52:42 -0500
committertom barrett <spalf0@gmail.com>2019-07-22 02:52:42 -0500
commitf351a002b66ae8a4b73588b7ffdffc69623181f3 (patch)
treef05544733b15702d342ec0f6299b7f4e6a8d30c0
parent7baa6cde8a4f6db03356fa692f0afbd992013e6b (diff)
cleanup
-rw-r--r--README.md1
-rw-r--r--src/npc.rs8
-rw-r--r--src/tile.rs11
3 files changed, 4 insertions, 16 deletions
diff --git a/README.md b/README.md
index f622ce3..0da33e2 100644
--- a/README.md
+++ b/README.md
@@ -7,4 +7,3 @@
* textbox (with dialog options)
* impl EventHandler instead of Operable?
-* npc movement
diff --git a/src/npc.rs b/src/npc.rs
index ad2a750..92d7a1d 100644
--- a/src/npc.rs
+++ b/src/npc.rs
@@ -24,8 +24,8 @@ impl Operable for NPC {
fn update(&mut self) {
match self.behavior {
- Behavior::Wandering(destination) => self.wandering(destination),
- Behavior::Waiting(time) => self.waiting(time),
+ Behavior::Wandering(destination) => self.move_torwards(destination),
+ Behavior::Waiting(time) => self.wait(time),
}
self.entity.update();
self.animations.update(&self.entity.action);
@@ -41,7 +41,7 @@ impl NPC {
}
}
- fn wandering(&mut self, destination: Point2<f32>) {
+ fn move_torwards(&mut self, destination: Point2<f32>) {
let position = self.entity.position;
if distance(&position, &destination) < constants::GOAL_DISTANCE {
@@ -74,7 +74,7 @@ impl NPC {
}
}
- fn waiting(&mut self, start: Instant) {
+ fn wait(&mut self, start: Instant) {
if start.elapsed().as_secs() > constants::WAIT_TIME {
self.behavior = Behavior::Wandering(random_nearby_point(
self.entity.spawn,
diff --git a/src/tile.rs b/src/tile.rs
index c86706f..aa950df 100644
--- a/src/tile.rs
+++ b/src/tile.rs
@@ -78,17 +78,6 @@ impl Properties {
Err(_) => None,
};
- /*
- if scramble_delay {
- println!("in");
- let mut rng = rand::thread_rng();
- let d = delay.unwrap() as f32;
- let normal = Normal::new(d, d * 0.50).unwrap();
- delay = Some(normal.sample(&mut rng) as usize);
- println!("{:?}", delay);
- }
- */
-
Properties {
rotation: 0.0,
entity,