Renamed to random_walk since that's what it called. Closes #26.

master
Zed A. Shaw 20 hours ago
parent 769530b45c
commit 57d69015c2
  1. 2
      map.cpp
  2. 3
      map.hpp
  3. 4
      systems.cpp

@ -118,7 +118,7 @@ Point Map::center_camera(const Point &around, size_t view_x, size_t view_y) {
* drunkenly gradually reaching the player, and dodging * drunkenly gradually reaching the player, and dodging
* in and out. * in and out.
*/ */
bool Map::neighbors(Point &out, bool random, int direction) { bool Map::random_walk(Point &out, bool random, int direction) {
return $paths.random_walk(out, random, direction); return $paths.random_walk(out, random, direction);
} }

@ -50,8 +50,7 @@ public:
bool inmap(size_t x, size_t y); bool inmap(size_t x, size_t y);
bool iswall(size_t x, size_t y); bool iswall(size_t x, size_t y);
bool can_move(Point move_to); bool can_move(Point move_to);
// BUG: this isn't really neighbors anymore. Maybe move? Walk? bool random_walk(Point &out, bool random=false, int direction=PATHING_TOWARD);
bool neighbors(Point &out, bool random=false, int direction=PATHING_TOWARD);
void make_paths(); void make_paths();
void set_target(const Point &at, int value=0); void set_target(const Point &at, int value=0);

@ -89,9 +89,9 @@ void System::enemy_pathing(GameLevel &level) {
Point out = position.location; // copy Point out = position.location; // copy
if(enemy_ai.wants_to("find_enemy")) { if(enemy_ai.wants_to("find_enemy")) {
map.neighbors(out, motion.random, PATHING_TOWARD); map.random_walk(out, motion.random, PATHING_TOWARD);
} else if(enemy_ai.wants_to("run_away")) { } else if(enemy_ai.wants_to("run_away")) {
map.neighbors(out, motion.random, PATHING_AWAY); map.random_walk(out, motion.random, PATHING_AWAY);
} }
motion = { int(out.x - position.location.x), int(out.y - position.location.y)}; motion = { int(out.x - position.location.x), int(out.y - position.location.y)};

Loading…
Cancel
Save