Viewport

From MZXWiki
Revision as of 17:18, 26 January 2011 by Old-Sckool (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Viewport is essentially a window that the player looks through in order to see the elements on a board. With it, you can limit the viewable area of a board, adjust the location in which the viewport is drawn on the screen (as long as the viewport is smaller than 80x25), modify how the viewport scrolls along the board, and even choose which location of the board should be viewable.

A nice thing about the viewport is that it will automatically track the player's movements, and make sure that the player is always visible on screen by default. This functionality can also be applied to sprites by setting the SPRn_VIEW counter to 1.

Aside from setting the edge color, all of the viewport's internal values are stored locally, per board. You can set the viewport's size and position relative to the screen through the ALT-P command in the world editor. The default edge color can be set by using the ALT-G command in the world editor, then selecting the "More" button.

Commands

VIEWPORT # #

VIEWPORT SIZE # #

SCROLLVIEW dir #

SCROLLVIEW POSITION

RESETVIEW

Counters

SCROLLEDX

SCROLLEDY

SPRn_SETVIEW