diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-21 18:05:27 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-21 18:05:27 +0100 |
commit | 993dde2e427127e0c1eb20099c1e014228050c90 (patch) | |
tree | 0b9b3e3471d691437d185057f37b27230e053a09 /src/critter.cpp | |
parent | f3dd8b426f5f39bebc64ed1fae39c8b7d73a6aa5 (diff) |
w auto movement
Diffstat (limited to 'src/critter.cpp')
-rw-r--r-- | src/critter.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/critter.cpp b/src/critter.cpp index 3e88d8df..2d0393f3 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -123,10 +123,12 @@ bool critter_proto::operator==(const object_proto& e0) const void critter::set_keys(bool L, bool R, bool U, bool D) { - b_L = L; - b_R = R; - b_U = U; - b_D = D; + movement = { L, R, U, D, false }; +} + +void critter::set_keys_auto() +{ + movement = { false, false, false, false, true }; } float critter::depth_offset() const @@ -144,14 +146,17 @@ void critter::update(size_t i, Ns dt) { if (playable) { - const auto new_r = arrows_to_dir(b_L, b_R, b_U, b_D); - if (new_r == rotation_COUNT) + if (!movement.AUTO) { - offset_frac = {}; - delta = 0; + const auto new_r = arrows_to_dir(movement.L, movement.R, movement.U, movement.D); + if (new_r == rotation_COUNT) + { + offset_frac = {}; + delta = 0; + } + else + update_movement(i, dt, new_r); } - else - update_movement(i, dt, new_r); } else update_nonplayable(i, dt); |