Example #1
0
void Level::moveCreature(Creature* creature, Vec2 direction) {
  CHECK(canMoveCreature(creature, direction));
  Vec2 position = creature->getPosition();
  Square* nextSquare = getSquare(position + direction);
  Square* thisSquare = getSquare(position);
  thisSquare->removeCreature();
  creature->setPosition(position + direction);
  nextSquare->putCreature(creature);
  notifyLocations(creature);
}
Example #2
0
void Level::moveCreature(Creature* creature, Vec2 direction) {
  CHECK(canMoveCreature(creature, direction));
  Vec2 position = creature->getPosition();
  bucketMap->moveElement(position, position + direction, creature);
  Square* nextSquare = getSafeSquare(position + direction);
  Square* thisSquare = getSafeSquare(position);
  thisSquare->removeCreature();
  creature->setPosition(position + direction);
  nextSquare->putCreature(creature);
  if (creature->isAffected(LastingEffect::DARKNESS_SOURCE)) {
    addDarknessSource(position + direction, darknessRadius);
    removeDarknessSource(position, darknessRadius);
  }
}
Example #3
0
void Level::moveCreature(Creature* creature, Vec2 direction) {
  CHECK(canMoveCreature(creature, direction));
  Vec2 position = creature->getPosition().getCoord();
  unplaceCreature(creature, position);
  placeCreature(creature, position + direction);
}