Commit 99f70014 authored by Florian Oetke's avatar Florian Oetke
Browse files

restricted stationary attack to once per beat [fixed #30]

parent c932312b
Pipeline #3322 passed with stage
in 2 minutes and 47 seconds
......@@ -57,14 +57,15 @@ namespace phase_shifter::gameplay {
move.move = false;
if(allowed) {
move.beats_since_move = 0;
auto aim_len = glm::length(move.aim);
if(aim_len < 0.0001f) {
// TODO: attack
} else {
// start movement
move.beats_since_move = 0;
move.step_time_left = beat.avg_beat_time * move.step_time_percentage;
move.step_time = move.step_time_left;
move.step_time_left = beat.avg_beat_time * move.step_time_percentage;
move.step_time = move.step_time_left;
move.last_step =
(aim_len > 1.f ? move.aim / aim_len : move.aim) * move.distance_per_step;
}
......
......@@ -21,11 +21,13 @@ namespace phase_shifter::input {
_mailbox.subscribe_to([&](Once_action& e) {
switch(e.id) {
case "the_button"_strid:
case "the_button"_strid: {
for(auto&& [_, m] : _ecs.list<Input_controller_comp, gameplay::Movement_comp>()) {
m.aim = _aim;
m.move = true;
}
break;
}
}
});
......@@ -53,11 +55,7 @@ namespace phase_shifter::input {
_mailbox.subscribe_to([&](Range_action& e) {
switch(e.id) {
case "aim"_strid:
for(auto&& [_, m] : _ecs.list<Input_controller_comp, gameplay::Movement_comp>()) {
m.aim = {e.abs.x, e.abs.y};
}
break;
case "aim"_strid: _aim = {e.abs.x, e.abs.y}; break;
}
});
}
......
......@@ -30,6 +30,8 @@ namespace phase_shifter::input {
bool _key_move_right = false;
float _key_move_timer = 0.f;
bool _key_move_queued = false;
glm::vec2 _aim{0.f, 0.f};
};
} // namespace phase_shifter::input
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment