Retocados nombres de variables antiguos

This commit is contained in:
2022-08-26 19:53:19 +02:00
parent a4000d25db
commit 5ff62a6950
12 changed files with 273 additions and 201 deletions

View File

@@ -24,8 +24,8 @@ Player::Player(SDL_Renderer *renderer, Asset *asset, Input *input, Map *map)
vx = 0;
vy = 0;
lastPosition = {(int)x, (int)y};
const SDL_Rect rect = {(int)x, (int)y, 16, 24};
sprite->setPos(rect);
const SDL_Rect rect = {(int)x, (int)y, w, h};
sprite->setRect(rect);
sprite->setCurrentAnimation("stand");
sprite->setFlip(SDL_FLIP_NONE);
@@ -65,9 +65,9 @@ Player::~Player()
void Player::update()
{
checkInput();
// addGravity();
move();
animate();
checkActors();
}
// Dibuja el objeto
@@ -372,4 +372,11 @@ void Player::switchBorders()
void Player::setMap(Map *map)
{
this->map = map;
}
// Comprueba las interacciones con los actores
int Player::checkActors()
{
SDL_Rect rect = sprite->getRect();
return map->actorCollision(rect);
}