feat(demo): attract mode amb pilot IA, escenaris curats i música contínua del títol
This commit is contained in:
@@ -85,16 +85,24 @@ void Ship::processInput(float delta_time, uint8_t player_id) {
|
||||
? input->checkActionPlayer1(InputAction::THRUST, Input::ALLOW_REPEAT)
|
||||
: input->checkActionPlayer2(InputAction::THRUST, Input::ALLOW_REPEAT);
|
||||
|
||||
if (ROTATE_RIGHT) {
|
||||
applyMovement(ROTATE_LEFT, ROTATE_RIGHT, THRUST, delta_time);
|
||||
}
|
||||
|
||||
void Ship::applyMovement(bool rotate_left, bool rotate_right, bool thrust, float delta_time) {
|
||||
if (is_hit_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rotate_right) {
|
||||
body_.angle += config_.physics.rotation_speed * delta_time;
|
||||
}
|
||||
if (ROTATE_LEFT) {
|
||||
if (rotate_left) {
|
||||
body_.angle -= config_.physics.rotation_speed * delta_time;
|
||||
}
|
||||
|
||||
// Thrust: fuerza vectorial en la dirección de la nariz.
|
||||
// angle - PI/2 porque angle=0 apunta hacia arriba (eje Y negativo SDL).
|
||||
if (THRUST) {
|
||||
if (thrust) {
|
||||
const float DIR_X = std::cos(body_.angle - (Constants::PI / 2.0F));
|
||||
const float DIR_Y = std::sin(body_.angle - (Constants::PI / 2.0F));
|
||||
const float MAGNITUDE = body_.mass * config_.physics.acceleration;
|
||||
|
||||
Reference in New Issue
Block a user