Treballant en els game_texts

This commit is contained in:
2024-10-15 14:02:37 +02:00
parent 3b9885ab03
commit 3fdd60c9e2
5 changed files with 136 additions and 163 deletions

View File

@@ -5,16 +5,16 @@
class Texture;
// Constructor
Item::Item(int kind, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
Item::Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
: sprite_(std::make_unique<AnimatedSprite>(texture, "", animation)),
accel_x_(0.0f),
floor_collision_(false),
kind_(kind),
type_(type),
enabled_(true),
play_area_(play_area),
time_to_live_(600)
{
if (kind == ITEM_COFFEE_MACHINE)
if (type == ItemType::COFFEE_MACHINE)
{
width_ = 28;
height_ = 37;
@@ -104,7 +104,7 @@ void Item::move()
}
// Si se sale por arriba rebota (excepto la maquina de café)
if ((pos_y_ < param.game.play_area.rect.y) && !(kind_ == ITEM_COFFEE_MACHINE))
if ((pos_y_ < param.game.play_area.rect.y) && !(type_ == ItemType::COFFEE_MACHINE))
{
// Corrige
pos_y_ = param.game.play_area.rect.y;
@@ -122,7 +122,7 @@ void Item::move()
accel_x_ = 0;
accel_y_ = 0;
pos_y_ = play_area_->h - height_;
if (kind_ == ITEM_COFFEE_MACHINE)
if (type_ == ItemType::COFFEE_MACHINE)
{
floor_collision_ = true;
}
@@ -190,9 +190,9 @@ int Item::getHeight()
}
// Obtiene del valor de la variable
int Item::getClass()
ItemType Item::getType()
{
return kind_;
return type_;
}
// Obtiene el valor de la variable