MapSearchNode::MapSearchNode(const LevelMap& map, int16_t x_, int16_t y_, const PlayerDirection& direction_) noexcept : x(x_), y(y_), direction(direction_) { if (map.isMapCoordValid(x_, y_) == true) { cost = map[x_][y_].Passable() ? NodePassable : NodeNotPassable; } else { cost = NodeInvalid; } }
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; }