collision map
This commit is contained in:
@@ -591,16 +591,16 @@ void Player::updateColliderPoints() {
|
||||
const float Y1 = y_ + 8;
|
||||
const float Y2 = y_ + 16;
|
||||
const float Y3 = y_ + HEIGHT - 1;
|
||||
collider_points_[0] = {.x = L, .y = Y0};
|
||||
collider_points_[1] = {.x = M, .y = Y0};
|
||||
collider_points_[2] = {.x = R, .y = Y0};
|
||||
collider_points_[3] = {.x = L, .y = Y1};
|
||||
collider_points_[4] = {.x = M, .y = Y1};
|
||||
collider_points_[5] = {.x = R, .y = Y1};
|
||||
collider_points_[6] = {.x = L, .y = Y2};
|
||||
collider_points_[7] = {.x = M, .y = Y2};
|
||||
collider_points_[8] = {.x = R, .y = Y2};
|
||||
collider_points_[9] = {.x = L, .y = Y3};
|
||||
collider_points_[0] = {.x = L, .y = Y0};
|
||||
collider_points_[1] = {.x = M, .y = Y0};
|
||||
collider_points_[2] = {.x = R, .y = Y0};
|
||||
collider_points_[3] = {.x = L, .y = Y1};
|
||||
collider_points_[4] = {.x = M, .y = Y1};
|
||||
collider_points_[5] = {.x = R, .y = Y1};
|
||||
collider_points_[6] = {.x = L, .y = Y2};
|
||||
collider_points_[7] = {.x = M, .y = Y2};
|
||||
collider_points_[8] = {.x = R, .y = Y2};
|
||||
collider_points_[9] = {.x = L, .y = Y3};
|
||||
collider_points_[10] = {.x = M, .y = Y3};
|
||||
collider_points_[11] = {.x = R, .y = Y3};
|
||||
}
|
||||
@@ -680,15 +680,24 @@ void Player::updateVelocity(float delta_time) {
|
||||
target = HORIZONTAL_VELOCITY * room_->getConveyorBeltDirection();
|
||||
} else {
|
||||
switch (wanna_go_) {
|
||||
case Direction::LEFT: target = -HORIZONTAL_VELOCITY; break;
|
||||
case Direction::RIGHT: target = HORIZONTAL_VELOCITY; break;
|
||||
default: target = 0.0F; break;
|
||||
case Direction::LEFT:
|
||||
target = -HORIZONTAL_VELOCITY;
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
target = HORIZONTAL_VELOCITY;
|
||||
break;
|
||||
default:
|
||||
target = 0.0F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Orientación del sprite según la dirección deseada (sin cambiar cuando target=0)
|
||||
if (target > 0.0F) { sprite_->setFlip(Flip::RIGHT); }
|
||||
else if (target < 0.0F) { sprite_->setFlip(Flip::LEFT); }
|
||||
if (target > 0.0F) {
|
||||
sprite_->setFlip(Flip::RIGHT);
|
||||
} else if (target < 0.0F) {
|
||||
sprite_->setFlip(Flip::LEFT);
|
||||
}
|
||||
|
||||
// Inercia:
|
||||
// - En el aire: inercia completa (arranque y frenada graduales)
|
||||
|
||||
Reference in New Issue
Block a user