Sprites
Of course, any game needs some graphics, right? In Kwyll there are two main places you can draw pixel graphics, Sprites, and Tiles. A sprite in Kwyll is a rectangular grid of pixels, sprites can be various sizes, always in increments of 8 pixels in both axes. So, for example, 8x8, 16x16, 8x16, etc. An arbitrary limit is placed on the maximum size of 32 in either axis just to keep things within reason for the target platforms to maintain performance and limit memory use.
It is important to know that a sprite doesn’t actually 'do' anything in Kwyll, it’s just an image, it has no position, it isn’t by default drawn to the screen anywhere, in order to get a Sprite onto the screen, it must be used by an Object.
Draw Modes
On the Spectrum, when a sprite is assigned to an oject, you can choose which mode to use to draw the sprite to the screen, which is best depends on the particular use case in your game. The optons are:
- LOAD
-
The sprite is just drawn into each 8x8 cell that it touches, completely overwriting anything that might already be there in the Tilemap or any other objects. This is normally only used if you know there will be no background where the object is used. This is the fastes sprite rendering mode.
- OR/XOR
-
These two modes combine the pixels of the sprite with those in the background using bitwise OR and XOR operations. The result is that the background isn’t completely wiped out in 8x8 blocks like LOAD mode, but depending on the nature of the sprite and the tiled background, can result in objects becoming difficult to see. This is suitable for cases where you know the background isn’t too complex or detailed and you need speed. This is the second fastest sprite rendering mode.
- MASK
-
This requires that a sprite is defined with a Mask layer, see the Sprite Editor for details of creating mask layers. This mode clears a part of the background in a user defined shape before drawing the sprite pixels into that space. It is the most visually effective draw mode, resulting in well defined pixels that can be easily distinguished from the background, but is the most costly in terms of both memory use, requiring additional data for each sprite, and in terms of performance.