Skip to main content

Sprites

Sprites are the graphics used by playable or interactive characters in your scenes. You can import sprites with the button if you want to load the PNG as-is. You can also convert any PNG into MD Engine format with the button. For more information regarding this, you can check the Image Converter section.

You can also add sprites to your game by including .png files in your project's assets/sprites folder.

Image Requirements​

The image size must be a multiple of 8px in both width and height. If you add the sprite as-is, it must be an indexed .png file with a maximum of 16 colors. If you are unsure about the color requirements you can always use the Image Converter.

Animated Sprites​

If you want to have sprites that play animations, you need to make your PNG image containing each animation on a separate row.

Animated Sprite

Each row will represent one animation, during compile time empty space will be optimized out, so it's not a problem if there are some rows that have more empty space than needed.

Settings​

Sprites settings have two main sections Animation Settings and Sprite Settings.

Animation Settings​

There are two main options to edit here, Animation Cell Size and Animation Speed Type.

Animation Settings

Animation Cell Size​

This represents the size of an individual frame of the image.

Animation Speed Type​

This represents the type of animation setup.
You have three different options:

  • Global speed
  • Per Animation speed
  • Per Frame speed
Global speed​

With this option all the sprite animations and frames have the same speed.
It's the simplest option and works best for simple decorations and NPCs.

Per Animation speed​

With this option, each animation can have different speed values.
This allows you to have faster animations and slower animations when both have the same number of frames.

If you select this option you can edit the value in the Frames window.

Animation Speed
Per Frame speed​

Each frame of each animation can have different speed values. This allows some frames to stay longer than others without manually duplicating them on the PNG image.

If you select this option you can edit the value in the Frames window under each frame.

Frame Speed

Sprite Settings​

The Sprite settings hold information related to how the sprite will be used when attached to an actor and how it will be stored in the ROM.

Sprite Settings

Compression Mode​

This represents how the image is compressed when compiled into the ROM.

You have four different options:

  • Best
  • No Compression
  • APLIB: good but slow, don't use it for streamed / animated stuff.
  • Custom LZ4: average ratio but fast, recommended for streamed / animated stuff.

The best option if you are just starting is to use No Compression for sprites with animations and Best or APLIB for static sprites with just 1 frame.
Using Best or APLIB will increase the scene loading time but the ROM will be smaller.

Optimization Type​

This represents how the image is optimized during the compile time.

You have four different options:

  • Balanced: Balance between used tiles and hardware sprites.
  • Sprite: Reduce the number of hardware sprites at the expense of more used tiles.
  • Tile: Reduces the number of tiles at the expense of more hardware sprites.
  • No Optimization: cover the whole sprite frame.

The best option if you are just starting is to use Balanced.
If your sprite is too big it will cause problems during compile time.

Hardware Sprites​

Each sprite is composed of an internal type of object called hardware sprite.

They are a small, independently drawn graphic element that the video hardware can move, flip, or hide without redrawing the whole background.

There are a total of 80 hardware sprites available.
Each hardware sprite can be 8, 16, 24, or 32 pixels wide and independently 8, 16, 24, or 32 pixels tall. The largest is 32×32 pixels.

There is also a scanline limit, even though 80 sprites can exist, only 20 can appear on a single scanline (horizontal row).
If more than 20 overlap, the excess don’t appear (they “drop out”) — classic flicker behavior.
This limit can be removed for the Desktop Export with the Enhanced Mode.

Maximum Sprite Sizes​

One MD Engine Sprite can have a maximum of 16 hardware sprites.

Sixteen 32×32 hardware sprites cover at most the same drawn area as a 128×128 image. A frame can be wider or taller if its occupied cells still fit within the 16-sprite limit.

warning

If a sprite uses more than 16 hardware sprites, the following error would be printed on build:
Sprite frame '<sprite_symbol>' uses 20 internal sprites, that is above the limit (16), try to reduce the sprite size or split it.