Pixel precision

From MZXWiki
(Redirected from Pixel-perfect)
Jump to navigation Jump to search

Pixel precision in Megazeux is a technique where elements of a game are drawn, move, or appear to move at a finer precision than individual chars. There are several ways to achieve this effect, but the easiest (and recommended) way is to use unbound sprites.

Details

After 2.90

The primary feature of unbound sprites (introduced in MegaZeux 2.90) is to be able to easily achieve pixel precision sprite movement. When the SPRn_UNBOUND counter is set to 1, the sprite's X and Y values will be interpreted as pixel values instead of char values. This also affects the X and Y values of the sprite's collision box. Unbound sprites have many other useful features such as pixel-based collision, the ability to use alternate character sets instead of the world's regular character set, and the option to make one of the colors they display fully transparent.

Before 2.90

A common method of giving objects the appearance of pixel-precise movement is to draw the entire game using half-char characters. The CHAR EDIT command or the CHAR_X/CHAR_Y/PIXEL or CHAR/CHAR_BYTE/BYTE counters can be used to make game elements appear to be moving at subchar precision, though this technique can be complicated in some cases.

MZX Forks

Logicow released a Megazeux fork which featured a draw command that allowed the drawing of pixel-precise objects on the screen. This particular command has not been introduced to the main Megazeux line and likely never will be.

Examples

After 2.90

Currently, no games using unbound sprites have been released.

Before 2.90