SpriteChange* sprite_change = worldmap->at_sprite_change(tile_pos);
if(sprite_change != NULL) {
sprite.reset(new Sprite( *(sprite_change->sprite.get()) ));
- sprite_change->in_stay_action = false;
- }
-
- Teleporter* teleporter = worldmap->at_teleporter(tile_pos);
- if (teleporter) {
- if (teleporter->worldmap != "") {
- worldmap->change(teleporter->worldmap, teleporter->spawnpoint);
- } else {
- worldmap->move_to_spawnpoint(teleporter->spawnpoint);
- }
+ sprite_change->clear_stay_action();
}
// if this is a special_tile with passive_message, display it
}
}
- // stop if we reached a level, a WORLDMAP_STOP tile or a special tile without a passive_message
+ // check if we are at a Teleporter
+ Teleporter* teleporter = worldmap->at_teleporter(tile_pos);
+
+ // stop if we reached a level, a WORLDMAP_STOP tile, a teleporter or a special tile without a passive_message
if ((worldmap->at_level())
|| (worldmap->at(tile_pos)->getData() & Tile::WORLDMAP_STOP)
|| (special_tile && !special_tile->passive_message
- && special_tile->script == "")) {
+ && special_tile->script == "")
+ || (teleporter)) {
if(special_tile && !special_tile->map_message.empty()
&& !special_tile->passive_message)
worldmap->passive_message_timer.start(0);
SpriteChange* next_sprite = worldmap->at_sprite_change(next_tile);
if(next_sprite != NULL && next_sprite->change_on_touch) {
sprite.reset(new Sprite( *(next_sprite->sprite.get()) ));
- next_sprite->in_stay_action = false;
+ next_sprite->clear_stay_action();
}
SpriteChange* last_sprite = worldmap->at_sprite_change(tile_pos);
if(last_sprite != NULL && next_sprite != NULL) {
log_debug << "Old: " << tile_pos << " New: " << next_tile << std::endl;
- last_sprite->in_stay_action = true;
+ last_sprite->set_stay_action();
}
tile_pos = next_tile;
tryStartWalking();
}
+void
+Tux::setup()
+{
+ // check if we already touch a SpriteChange object
+ SpriteChange* sprite_change = worldmap->at_sprite_change(tile_pos);
+ if(sprite_change != NULL) {
+ sprite.reset(new Sprite( *(sprite_change->sprite.get()) ));
+ sprite_change->clear_stay_action();
+ }
+}
+
}