updated movingsprite.cpp
This commit is contained in:
@@ -15,7 +15,8 @@ MovingSprite::~MovingSprite()
|
||||
}
|
||||
|
||||
// Iniciador
|
||||
void MovingSprite::init(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, LTexture *texture, SDL_Renderer *renderer)
|
||||
void MovingSprite::init(float x, float y, Uint16 w, Uint16 h, float velx, float vely, float accelx, float accely,
|
||||
LTexture *texture, SDL_Renderer *renderer)
|
||||
{
|
||||
// Establece el alto y el ancho del sprite
|
||||
setWidth(w);
|
||||
@@ -43,11 +44,17 @@ void MovingSprite::init(float x, float y, int w, int h, float velx, float vely,
|
||||
setSpriteClip(0, 0, w, h);
|
||||
}
|
||||
|
||||
// Mueve el sprite
|
||||
// Coloca el sprite en su nueva posición en funcion de la velocidad
|
||||
void MovingSprite::move()
|
||||
{
|
||||
mPosX += mVelX;
|
||||
mPosY += mVelY;
|
||||
}
|
||||
|
||||
// Actualiza las variables internas del sprite: posición y velocidad
|
||||
void MovingSprite::update()
|
||||
{
|
||||
move();
|
||||
|
||||
mVelX += mAccelX;
|
||||
mVelY += mAccelY;
|
||||
|
||||
Reference in New Issue
Block a user