summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 5dc9af8..bfc698d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -117,7 +117,7 @@ public:
if (move.attempts_left) {
move.blocked = true;
move.attempts_left--;
- move.next_attempt = now + 0.5f;
+ move.next_attempt = now + 0.2f;
} else {
if ((x - move.dst).len() > 1.5f)
say(text::unit_blocked, now);
@@ -160,7 +160,13 @@ public:
class human_t : public unit_t {
public:
- double last_follow = -INFINITY;
+ human_t()
+ {
+ size[0] = v2f_t(-0.4f, -0.4f);
+ size[1] = v2f_t(+0.4f, +0.4f);
+ render_size[0] = v2f_t(-0.5f, -1.0f);
+ render_size[1] = v2f_t(+0.5f, +0.5f);
+ }
void render_to(render::state_t *render)
{
@@ -192,21 +198,24 @@ public:
}
};
-static human_t human, human2;
-
void state_t::start(void)
{
- human.size[0] = v2f_t(-0.4f, -0.4f);
- human.size[1] = v2f_t(+0.4f, +0.4f);
- human.render_size[0] = v2f_t(-0.5f, -1.0f);
- human.render_size[1] = v2f_t(+0.5f, +0.5f);
- human.place(&world, v2f_t(2.5f, -3.5f));
-
- human2.size[0] = v2f_t(-0.4f, -0.4f);
- human2.size[1] = v2f_t(+0.4f, +0.4f);
- human2.render_size[0] = v2f_t(-0.5f, -1.0f);
- human2.render_size[1] = v2f_t(+0.5f, +0.5f);
- human2.place(&world, v2f_t(3.5f, 0.5f));
+ for (size_t i = 0; i < 10; i++) {
+ human_t *human;
+
+ human = new human_t;
+ human->place(&world, v2f_t(0.5, 0.5) + i * v2f_t(0.2, -1.2f));
+ units.insert(human);
+ }
+}
+
+void state_t::stop(void)
+{
+ // FIXME
+ /*
+ for (unit_t *unit : units)
+ delete unit;
+ */
}
void state_t::select(rectf_t x)
@@ -235,8 +244,9 @@ void state_t::command(v2f_t x)
void state_t::tick(double now_)
{
now = now_;
- human.keep_moving(now_);
- human2.keep_moving(now_);
+
+ for (unit_t *unit : units)
+ unit->keep_moving(now);
}
} //namespace game