feat: changed tactics controls

This commit is contained in:
Sara 2024-05-02 15:06:20 +02:00
parent f82365b08b
commit 85b0c66cb3

View file

@ -54,18 +54,13 @@ void TunnelsPlayer::_process(double delta_time) { GDGAMEONLY();
case State::ManualControl:
// send the current wasd input to the character
this->character->move(this->get_world_move_input().normalized());
// fall through to shared functionality
case State::Tactics:
// send the current world cursor position the character
this->character->aim(mouse_world_location);
// move the camera along with the character
this->set_global_position(this->character->get_global_position());
break;
case State::Tactics:
// move camera along with the input
this->set_global_position(this->get_global_position() + this->get_world_move_input().normalized() *
delta_time * TunnelsPlayer::TACTICS_MOVEMENT_SPEED);
break;
case State::Overview:
break;
}
}
@ -142,8 +137,6 @@ void TunnelsPlayer::fire_pressed(Ref<InputEvent> event, float value) {
if(value == 1.f)
this->try_select_marker();
break;
case State::Overview:
break;
}
}
@ -166,6 +159,7 @@ void TunnelsPlayer::try_select_marker() {
if(marker == nullptr)
return;
UtilityFunctions::print("Hit: ", marker->get_path());
// select a character to send orders to
CharacterActor *target_character{nullptr};
for(CharacterActor *loop_character : Ref<TunnelsGameMode>(GameRoot::get_singleton()->get_game_mode())->get_player_characters()) {
if(loop_character != this->character) {
@ -256,5 +250,4 @@ float const TunnelsPlayer::ROTATION_SPEED{0.5f};
float const TunnelsPlayer::ROTATION_Y_MIN_INFLUENCE{7.f};
float const TunnelsPlayer::ROTATION_MARGIN{0.4f};
float const TunnelsPlayer::ROTATION_MARGIN_TACTICS_MUL{0.6f};
float const TunnelsPlayer::TACTICS_MOVEMENT_SPEED{10.f};
}