Skip to main content

HBlank & VBlank

The rendering process of each frame is split into two types of internals, where a callback can invoked.

  • Horizonal Blank or HBlank, it happens once per scanline
  • Vertical Blank or VBlank, it happens once per frame

You can enable these with the OnStart: Set Horizonal Blank Script event for HBlank and OnStart: Set Vertical Blank Script event for VBlank.

info

Theses events can only be placed inside a Scene On Start script.

There are some operations that can be done during these periods, such us changing palette colors, adjusting Window Plane or changing scroll values.

You can review the HBlank - Palette example for a palette effect, and HBlank - Window Plane for a Window Plane effect.

HBlank script can be triggered every scanline if a Scanline Counter of 0 is used on the OnStart: Set Horizonal Blank Script event, any other values will make the script be triggered every (value + 1) scanline, for example, setting 5 means that the script will occurs each (5+1) scanline.

Allowed events inside HBlank & VBlank scripts

Inside these scripts there is a limited amount of events you can use, all the possible events start with Blank: if they can be used inside both scripts or with HBlank: for Horizonal Blank scripts only, and VBlank: for Vertical Blank events.

This happens due to the events inside these scripts compile to ASM instead of C code due to performance needs.

A full list of events can be seen bellow:

warning

Using events that are not on this list will result in the game not building!