magic numbers: bullet.cpp
This commit is contained in:
@@ -68,16 +68,14 @@ auto Bullet::update(float deltaTime) -> BulletMoveStatus {
|
||||
|
||||
// Implementación del movimiento usando BulletMoveStatus (time-based)
|
||||
auto Bullet::move(float deltaTime) -> BulletMoveStatus {
|
||||
// Convertir deltaTime (milisegundos) a factor de frame (asumiendo 60fps)
|
||||
float frameFactor = deltaTime / (1000.0f / 60.0f);
|
||||
|
||||
pos_x_ += vel_x_ * frameFactor;
|
||||
// DeltaTime puro: velocidad (pixels/ms) * tiempo (ms)
|
||||
pos_x_ += vel_x_ * deltaTime;
|
||||
if (pos_x_ < param.game.play_area.rect.x - WIDTH || pos_x_ > param.game.play_area.rect.w) {
|
||||
disable();
|
||||
return BulletMoveStatus::OUT;
|
||||
}
|
||||
|
||||
pos_y_ += VEL_Y * frameFactor;
|
||||
pos_y_ += VEL_Y * deltaTime;
|
||||
if (pos_y_ < param.game.play_area.rect.y - HEIGHT) {
|
||||
disable();
|
||||
return BulletMoveStatus::OUT;
|
||||
|
||||
Reference in New Issue
Block a user