bool tryMove(int x, int y, int testX, int testY, Entity& entity){ if(checkMapCollision(entity.getX()+x, entity.getY()+y, testX, testY) == 1){ entity.move(entity.getX()+x, entity.getY()+y); return true; }else if(checkMapCollision(entity.getX()+x, entity.getY()+y, testX, testY) == 2){ entity.setDead(true); return true; } return false; }
void Bullet::update() { checkBulletsObjectsCollision(); checkMapCollision(); if (!m_bDying) { move(); } else { doDyingAnimation(); } }
void Player::move() { m_velocity.setX(0); m_velocity.setY(0); handleInput(); // check for move capacity m_canMove = true; checkMovePosible(); checkObjectsCollision(); checkMapCollision(); //------------------------------ if (m_canMove) { m_position += m_velocity; } }