(x 38)
(y 21)
)
+ (worldmap-spawnpoint
+ (name "bridge")
+ (x 8)
+ (y 15)
+ )
+ (worldmap-spawnpoint
+ (name "bonus")
+ (x 1)
+ (y 26)
+ )
(level
(name "01 - Welcome to Antarctica.stl")
(x 22)
(sprite "images/objects/invisible/invisible.sprite")
)
(special-tile
- (teleport-to-x 9)
- (teleport-to-y 15)
- (x 16)
- (y 25)
- (sprite "images/worldmap/common/teleporterdot.sprite")
- )
- (special-tile
- (teleport-to-x 1)
- (teleport-to-y 26)
- (invisible-tile #t)
- (x 29)
- (y 18)
- )
- (special-tile
- (teleport-to-x 22)
- (teleport-to-y 4)
- (x 1)
- (y 26)
- (sprite "images/worldmap/common/teleporterdot.sprite")
- )
- (special-tile
(teleport-to-x 0)
(teleport-to-y 0)
(map-message (_ "You found a secret area!"))
(x 39)
(y 21)
)
+ (teleporter
+ (spawnpoint "bridge")
+ (interactive #t)
+ (x 1)
+ (y 26)
+ (sprite "images/worldmap/common/teleporterdot.sprite")
+ )
+ (teleporter
+ (spawnpoint "bonus")
+ (interactive #t)
+ (x 29)
+ (y 18)
+ )
+ (teleporter
+ (spawnpoint "bridge")
+ (interactive #t)
+ (x 16)
+ (y 25)
+ (sprite "images/worldmap/common/teleporterdot.sprite")
+ )
)
(tileset "images/worldmap.strf")
)
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);
- }
- }
-
// if this is a special_tile with passive_message, display it
SpecialTile* special_tile = worldmap->at_special_tile();
if(special_tile)
}
}
- // 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);
enter_level = true;
if(main_controller->pressed(Controller::PAUSE_MENU))
on_escape_press();
-
+
+ // check for teleporters
+ Teleporter* teleporter = at_teleporter(tux->get_tile_pos());
+ if (teleporter && ((!teleporter->interactive) || (enter_level && (!tux->is_moving())))) {
+ enter_level = false;
+ if (teleporter->worldmap != "") {
+ change(teleporter->worldmap, teleporter->spawnpoint);
+ } else {
+ sound_manager->play("sounds/warp.wav");
+ tux->back_direction = D_NONE;
+ move_to_spawnpoint(teleporter->spawnpoint);
+ }
+ }
+
if (enter_level && !tux->is_moving())
{
/* Check special tile action */
current_ = this;
load_state();
- // if force_spawnpoint was set, move Tux there
- if (force_spawnpoint != "") move_to_spawnpoint(force_spawnpoint);
+ // if force_spawnpoint was set, move Tux there, then clear force_spawnpoint
+ if (force_spawnpoint != "") {
+ move_to_spawnpoint(force_spawnpoint);
+ force_spawnpoint = "";
+ }
// register worldmap_table as worldmap in scripting
using namespace Scripting;