Ya se puede continuar al morir

This commit is contained in:
2022-10-04 21:40:33 +02:00
parent a5adf1ba01
commit 18c36ad3fb
9 changed files with 137 additions and 132 deletions

View File

@@ -2,11 +2,11 @@
#include "item.h"
// Constructor
Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 type, float x, float y)
Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 kind, float x, float y)
{
std::string filePNG;
std::string fileANI;
switch (type)
switch (kind)
{
case ITEM_POINTS_1_DISK:
filePNG = asset->get("item_points1_disk.png");
@@ -45,13 +45,13 @@ Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 type, float x, float y)
texture = new LTexture(renderer, filePNG);
sprite = new AnimatedSprite(texture, renderer, fileANI);
this->type = type;
this->kind = kind;
enabled = true;
timeToLive = 600;
accelX = 0.0f;
floorCollision = false;
if (type == ITEM_COFFEE_MACHINE)
if (kind == ITEM_COFFEE_MACHINE)
{
width = 23;
height = 29;
@@ -148,10 +148,10 @@ void Item::move()
}
// Si se sale por arriba rebota (excepto la maquina de café)
if ((posY < PLAY_AREA_TOP) && !(type == ITEM_COFFEE_MACHINE))
if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE))
{
// Corrige
posY = PLAY_AREA_TOP;
posY -= velY;
// Invierte el sentido
velY = -velY;
@@ -169,7 +169,7 @@ void Item::move()
accelX = 0;
accelY = 0;
posY = PLAY_AREA_BOTTOM - height;
if (type == ITEM_COFFEE_MACHINE)
if (kind == ITEM_COFFEE_MACHINE)
{
floorCollision = true;
}
@@ -239,7 +239,7 @@ int Item::getHeight()
// Obtiene del valor de la variable
int Item::getClass()
{
return type;
return kind;
}
// Obtiene el valor de la variable