summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-10-18 00:27:48 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-10-18 00:27:48 +0200
commitef5273d2c2ab801b11eb435a04bff96f6e778b1c (patch)
tree05c2a2097757a3d920eb3bb10fbf3e1bccceb938 /src/game.cpp
parent7d43c4e7ad6b83a23516b26b4aebf74f398c251b (diff)
Continue refactoring.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 59b8ad9..725d6f0 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -30,10 +30,8 @@ void state_t::start(void)
human_t &human = *(--humans.end());
- human.bounds.left = 0.33f;
- human.bounds.top = 0;
- human.bounds.width = 0.66f;
- human.bounds.height = 1.0f;
+ human.bounds.v[0] = v2f_t(0.33f, 0);
+ human.bounds.v[1] = human.bounds.v[0] + v2f_t(0.66f, 1.0f);
human.render_bounds = human.bounds;
human.link(&world);
}
@@ -47,11 +45,15 @@ void state_t::tick(void)
human.walking = false;
if (human.stalin < 0) {
+ v2f_t delta;
+
human.walking = true;
human.angle += (rand() & 2 ? 0.2f : -0.2f);
human.unlink();
- human.bounds.left += cos(human.angle) * 0.04;
- human.bounds.top += sin(human.angle) * 0.04;
+ delta = v2f_t(cos(human.angle), sin(human.angle)) * 0.04;
+ human.bounds[0] += delta;
+ human.bounds[1] += delta;
+ human.render_bounds = human.bounds;
human.link(&world);
}