Eliminado el fichero coffeedrop
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
#include "const.h"
|
||||
#include "coffeedrop.h"
|
||||
|
||||
#ifndef UNUSED
|
||||
|
||||
// Constructor
|
||||
CoffeeDrop::CoffeeDrop()
|
||||
{
|
||||
mPosX = 0;
|
||||
mPosY = 0;
|
||||
mWidth = 8;
|
||||
mHeight = 8;
|
||||
mVelX = 0;
|
||||
mVelY = 0;
|
||||
mGravity = 0.1f;
|
||||
mFloor = 0;
|
||||
mEnabled = false;
|
||||
mSprite = new Sprite();
|
||||
mAlpha = 128;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
CoffeeDrop::~CoffeeDrop()
|
||||
{
|
||||
delete mSprite;
|
||||
}
|
||||
|
||||
// Inicializador
|
||||
void CoffeeDrop::init(LTexture *texture, SDL_Renderer *renderer, float x, float y, float velX, float velY, int floor)
|
||||
{
|
||||
mEnabled = true;
|
||||
mPosX = x;
|
||||
mPosY = y;
|
||||
mVelX = velX;
|
||||
mVelY = velY;
|
||||
mFloor = floor;
|
||||
|
||||
mSprite->setRenderer(renderer);
|
||||
mSprite->setTexture(texture);
|
||||
mSprite->setSpriteClip(256, 97, mWidth, mHeight);
|
||||
mSprite->setPosX(x);
|
||||
mSprite->setPosY(y);
|
||||
}
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void CoffeeDrop::update()
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
mVelY += mGravity;
|
||||
mPosX += mVelX;
|
||||
mPosY += mVelY;
|
||||
|
||||
mSprite->setPosX((int)mPosX);
|
||||
mSprite->setPosY((int)mPosY);
|
||||
|
||||
if ((mPosY > mFloor) || (mPosX > PLAY_AREA_RIGHT) || ((mPosX - mWidth) < PLAY_AREA_LEFT))
|
||||
mEnabled = false;
|
||||
|
||||
mAlpha -= 2;
|
||||
if (mAlpha == 0)
|
||||
mEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Pinta el objeto
|
||||
void CoffeeDrop::render()
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
mSprite->getTexture()->setAlpha(mAlpha);
|
||||
mSprite->render();
|
||||
mSprite->getTexture()->setAlpha(255);
|
||||
}
|
||||
}
|
||||
|
||||
// Deshabilita el objeto
|
||||
void CoffeeDrop::disable()
|
||||
{
|
||||
mEnabled = false;
|
||||
}
|
||||
|
||||
// Comprueba si està habilitado
|
||||
bool CoffeeDrop::isEnabled()
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "sprite.h"
|
||||
|
||||
#ifndef COFFEEDROP_H
|
||||
#define COFFEEDROP_H
|
||||
|
||||
#ifndef UNUSED
|
||||
|
||||
// Clase CoffeeDrop. Gotas de café que aparecen al explotar un globo
|
||||
class CoffeeDrop
|
||||
{
|
||||
private:
|
||||
float mPosX; // Posicion en el eje X del objeto
|
||||
float mPosY; // Posicion en el eje Y del objeto
|
||||
Uint8 mWidth; // Ancho del sprite
|
||||
Uint8 mHeight; // Alto del sprite
|
||||
float mVelX; // Velocidad en el eje X
|
||||
float mVelY; // Velocidad en el eje Y
|
||||
float mGravity; // Aceleración en el eje Y
|
||||
int mFloor; // Punto donde se encuentra el suelo y desaparecen
|
||||
bool mEnabled; // Si esta habilitado. Sirve para saber si se pinta, se actualiza o se puede usar
|
||||
Sprite *mSprite; // Puntero al sprite con los graficos
|
||||
Uint8 mAlpha;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
CoffeeDrop();
|
||||
|
||||
// Destructor
|
||||
~CoffeeDrop();
|
||||
|
||||
// Inicializador
|
||||
void init(LTexture *texture, SDL_Renderer *renderer, float x, float y, float velX, float velY, int floor);
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void update();
|
||||
|
||||
// Pinta el objeto
|
||||
void render();
|
||||
|
||||
// Deshabilita el objeto
|
||||
void disable();
|
||||
|
||||
// Comprueba si està habilitado
|
||||
bool isEnabled();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -39,7 +39,7 @@ void Logo::checkLogoEnd()
|
||||
{
|
||||
if (counter >= END_LOGO + 20)
|
||||
{
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
section.name = PROG_SECTION_INTRO;
|
||||
section.subsection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user