bool Player::MapPosition(LevelMap& map, const PairFloat& pos) { drawPosA = map.toDrawCoord(mapPosition); drawPosB = map.toDrawCoord(pos); bool success = false; if (mapPosition != pos) { success = updateMapPositionBack(map, pos); } if (success == true || map.isMapCoordValid(pos) == true) { updateDrawPosition(map); } return success; }
bool Player::move(LevelMap& map, const PairFloat& pos) { if (mapPosition == pos || playerStatus == PlayerStatus::Dead || map.isMapCoordValid(pos) == false) { return false; } clearWalkPath(); setStandAnimation(); playerStatus = PlayerStatus::Stand; resetAnimationTime(); drawPosA = drawPosB = map.toDrawCoord(pos); bool success = updateMapPositionBack(map, pos); if (success == true) { updateDrawPosition(map); } return success; }