Passage

From Wiki of ZZT
Revision as of 03:50, 14 February 2021 by The Green Herring (talk | contribs) (Colors, multiple passages on one board, re-enter when zapped behavior)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Passage
ZZT-OOP namepassage
Internal ID11 (0x0B)
Character#char 240 (0xF0)
Categoryitem
Stats
Default cycle0
P3index of destination board (title screen is 0)
Other traits
Effect on movementwall; blocks movement of most entities but causes the player to teleport on touch
Destructible?no
Uses ZZT-OOP color names?yes, but named color affects background only; foreground is always white
Visible in the dark?yes

The passage element allows the player to switch the active board. They are one of the two ways to switch boards, the other being board edges.

By default, traveling via passage does not modify the destination board. However, if the destination contains a second passage with the same color, ZZT will reposition the player on top of that second passage, so that the two passage tiles appear to be two ends of the same passageway: the player steps in one and out the other.

Traveling through a passage will pause the game immediately after switching boards. This allows the player to examine the new board before play begins, so as not to be caught too off guard. However, this can lead to soft-locks if a passage is blocked off: a player can still enter a blocked passageway, but they won't be able to do anything, including returning to the previous board.

By default, placing a passage in the editor or through ZZT-OOP with the default colors creates a passage with a white foreground and a dark background color corresponding to the requested color, as shown below:

Default passage color chart
ZZT-OOP name Element color
Blue white on dark blue (0x1F)
Green white on dark green (0x2F)
Cyan white on dark cyan (0x3F)
Red white on dark red (0x4F)
Purple white on dark purple (0x5F)
Yellow white on dark brown (0x6F)
White white on light gray (0x7F)

However, the passage's functionality is not limited to these colors, because the engine takes both foreground and background colors into consideration when determining the player's position. Namely, it will only put the player on top of any passage with the same foreground and background color as the one they used. Thus, working passages can be made with any of the 256 possible color combinations that can be placed with an external editor.

In addition, if a passage directs the player to a board that has multiple passages of the same color, it will put the player on the passage furthest to the east regardless of the passage's Y position. This even applies if the destination is the same board they entered from, so a designer can make a one-way teleporter in this fashion.

As with the board edge, entering a "Re-enter when zapped" board through a passage will change the position the player will be reset to when hurt to where they entered the board, in this case on top of the passage.

Tile repositioning bug

Players traveling between identically-colored passages can disturb the surrounding tiles. Specifically, when ZZT repositions the player on top of the destination board's passage, it does so without updating the player stat's under type/color. In other words, ZZT relocates not just the player, but also the tile the player was previously standing on, leaving an empty in its place.

This bug mainly matters for passages adjacent to fake walls or to other passages, as these tiles can be overwritten when the player is repositioned. The bug can be avoided by making sure that passages are only surrounded by walls and empties, and by making sure that the player is placed on top of an empty tile when the board is created.