From ef5273d2c2ab801b11eb435a04bff96f6e778b1c Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 18 Oct 2017 00:27:48 +0200 Subject: Continue refactoring. --- src/game.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/game.cpp') 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); } -- cgit