Afegit el tamany de la coffee_machine als parametres

This commit is contained in:
2025-01-04 10:04:49 +01:00
parent eaab646cd3
commit 5e817ef1d0
5 changed files with 35 additions and 16 deletions

View File

@@ -14,10 +14,10 @@ Item::Item(ItemType type, float x, float y, SDL_Rect &play_area, std::shared_ptr
{
case ItemType::COFFEE_MACHINE:
{
width_ = 28;
height_ = 37;
width_ = param.game.coffee_machine_w;
height_ = param.game.coffee_machine_h;
pos_x_ = ((static_cast<int>(x) + (play_area.w / 2)) % (play_area.w - width_ - 5)) + 2;
pos_y_ = -height_;
pos_y_ = y;
vel_x_ = 0.0f;
vel_y_ = -0.1f;
accel_y_ = 0.1f;
@@ -26,8 +26,8 @@ Item::Item(ItemType type, float x, float y, SDL_Rect &play_area, std::shared_ptr
}
default:
{
width_ = 20;
height_ = 20;
width_ = param.game.item_size;
height_ = param.game.item_size;
pos_x_ = x;
pos_y_ = y;
vel_x_ = -1.0f + ((rand() % 5) * 0.5f);