Debug Mode

The debug mode is a KAPLAY integrated tool that helps you to debug your game. Now, we will see how to use it.

Inspect Mode

You can enable inpsect mode by pressing F1 key. This will open the debug panel.

You will see

  • The current FPS
  • Object areas (blue rectangle)
  • Object anchor points (red dot)
  • Object components properties

Logging

You can use (with or without the inpsect mode) the debug.log() function to log messages in the game screen.

debug.log("Hello, world!");

With F2, you can clear the log.

Controlling time

With the keys F7, F8, F9 you can control the time of the game.

F7 and F9 will decrease and increase the time speed, respectively. F8 will pause the game.

This is useful to test features in slow motion or to pause the game to inspect the objects.

Changing the default key for activate the debug mode

You can set the property KAPLAYOpt.debugKey to change the default key for activate the debug mode.

kaplay({
    debugKey: "r",
});

Disabling the debug mode

If your game is ready to be published, you can disable the debug mode by setting the property KAPLAYOpt.debug to false.

kaplay({
    debug: false,
});
kaplay logo

Making Your First Game

Expanding KAPLAY