Optional
assets?: BpxAssetsToLoadA list of URLs of assets to load. The URLs might be either relative to the ./public/
directory,
or external ones.
Allowed file extensions:
.png
– for images,.wav
– for music,.flac
– for music, smaller files than .wav
,.json
– for JSON files,.ldtk
– a convenience extension support for JSON files with the default extension used by LDtk tool, so you doesn't have to rename them.Optional
canvasThe logical canvas size. Not to be mistaken with a size of the HTML Canvas, which the user has no control over.
During the game, this value (as a BpxVector2d can be obtained with BeetPx.canvasSize.
Optional
debugA mode in which you can perform an additional logic, draw helpful markers, etc.
When active, the BeetPx.debug returns true
.
Visually, this mode is indicated by an orange border around the game canvas.
When inactive, the BeetPx.logDebug are not printed.
Optional
available?: booleanWhether to allow use to toggle the debug mode (with use of the ;
key).
A recommended approach would be to set it to the negation of BEETPX__IS_PROD.
Optional
forceWhether to activate the debug mode from the game start. Useful, when you want to investigate what happens on the very first frame. This setting ignores the persisted state of whether the debug mode was activated the last time the games was run.
Optional
fpsFPS Display shows the rendering FPS in one of the canvas corners, when in enabled and in the debug mode.
Optional
color?: BpxRgbColorThe color of the printed FPS on the canvas.
Optional
enabled?: booleanWhether the FPS Display should be shown in the debug mode.
Optional
placement?: BpxFpsDisplayPlacementThe placement of the printed FPS on the canvas.
Optional
fixedThe desired frequency of update calls. This is a basis for all time-based computations in the game, since BeetPx has no notion of the real time, nor delta time between update calls. The entire engine is based in a fixed timestep computations, where you can expect each game loop iteration to happen after the similar amount of time from the previous one.
60 FPS games looks smoother, but require more performant machine, if the game logic is computation heavy.
PleaseThis setting does not imply the rendering FPS, which is decoupled from the update calls.
Optional
frameOptional
activateWhether to activate the frame-by-frame mode from the game start. Useful, when you want to investigate what happens on the very first frame.
Optional
available?: booleanWhether to allow use to toggle the frame-by-frame mode (with use of the ,
key),
and (when in that mode) to progress to the next frame (with use of the .
key).
A recommended approach would be to set it to the negation of BEETPX__IS_PROD.
Used for scoping localStorage keys, so two different games won't override their persisted state.
An example: built-in screenshots feature binds screenshots to the proper game by its gameId
.
Optional
gameA feature which allows to toggle a game pause with use of a "menu" button. When active, the timers, animations, and music do not progress, unless configured to ignore the pause.
This also allows to implement a pause menu.
$x.setOnDraw(() => {
// ...
if ($x.isPaused) {
pauseMenu.draw();
}
});
https://github.com/beetrootpaul/beetpx-examples/tree/main/pause-and-restart
Optional
available?: booleanWhether the game pause should be available (and automatically toggled with the "menu" button).
Optional
requireWhether to prevent user from accidentally closing the browser tab with the game running.
A recommended approach would be to set it to BEETPX__IS_PROD
Optional
screenshots?: { Optional
available?: booleanWhether to allow user to take screenshots of the game (with use of the ]
key)
and access the screenshot browser overlay (with use of the }
key).
The configuration of the BeetPx engine. Passed into BeetPx.start.