BUILDNANA configurations.
groupStart
Width of game.
Height of game.
Pixel scale / size.
Keep aspect ratio and leave black bars on remaining spaces.
If register debug buttons (default true)
Key that toggles debug mode
font?: string
Default font (defaults to "monospace").
Device pixel scale (defaults to 1, high pixel density will hurt performance).
sincev3000.0
Disable antialias and enable sharp pixel display. If you see rendering artifacts, set `pixelDensity`
param to `Math.min(devicePixelRatio, 2)` and `scale` to FHD resolution (e.g. 960x540 would need scale 2). Will result in up to 4K.
canvas?: HTMLCanvasElement
The canvas DOM element to use. If empty will create one.
root?: HTMLElement
The container DOM element to insert the canvas if created. Defaults to document.body.
background?: RGBValue | RGBAValue | string
Background color. E.g. [ 0, 0, 255 ] for solid blue background, or [ 0, 0, 0, 0 ] for transparent background. Accepts RGB value array or string hex codes.
Default sprite texture filter.
default"nearest"
Default text rasterization filter.
default"linear" for vector fonts (.woff2, .ttf, .otf, etc)
"nearest" for bitmap fonts (loaded from an image)
How many log messages can there be on one screen (default 8).
How many seconds log messages stay on screen (default 4).
sincev3000.1
Size of the spatial hash grid for collision detection (default 64).
sincev3000.0
If translate touch events as mouse clicks (default true).
If BUILDNANA should render a default loading screen when assets are not fully ready (default true).
sincev3000.0
If pause audio when tab is not active (default false).
sincev3000.0
gamepads?: Record<string, GamepadDef>
Custom gamepad definitions (see gamepad.json for reference of the format).
sincev3000.0
Defined buttons for input binding.
sincev30010
Limit framerate to an amount per second.
sincev3000.0
The number of fixedUpdate() events that should happen per second.
The fixedUpdate() loop is used for physics.
The average user should never need to change this. If you set it too low
then your physics will freak out due to numerical instability. If you set it too high then
the game will lag.
The options are:
* friedPotato: 10Hz
* potato: 20Hz
* snail: 25Hz
* normal: 50Hz (default)
* lightspeed: 80Hz
* ridiculous: 125Hz
* ludicrous: 160Hz
groupPhysics
experimental
The maximum amount of time the game will simulate passing in order to
limit lag. If the framerate lags low enough that one frame takes
longer than this time, the game will instead use this as the delta time
value, which means that the game will run slower than 100% speed.
The average user should never need to change this. If you set it too
low, the game will slow down with even the slightest lag, and if you
set it too high then the game could try to do too much on each frame
and amplify the lag problem.
default0.1
groupPhysics
experimental
If focus on the canvas on start (default true).
sincev3001.0
If import all BUILDNANA functions to global (default true).
plugins?: PluginList<any>
List of plugins to import.
burp?: boolean
Enter burp mode.
Make components ids be added as tags.
That means .is() will return true for components with that id.
defaulttrue
Padding used when adding sprites to texture atlas.
default2
If the debug inspect view should ignore objects that are paused when choosing
the object to show the inspect view on.
defaultfalse
experimental
Which strategy to use for broad phase collision, sap, sapv or quadtree
default"sap"
Which strategy to use for narrow phase collision, gjk, sat or box
default"gjk"
If true, only the topmost object receives clicks
defaultfalse
Timeout (in milliseconds) at which other loaders waiting on sprites will give
up and throw an error.
Currently this is only used by .
default3000
The default lifetime scope used for event handlers.
default"scene"
types?: TypesOpt
TypeScript Advanced Features (TAF) are a series of options for TypeScript
only features.
It should be created using the helper function `buildnanaTypes`.
```ts
buildnana({
types: buildnanaTypes<Opt<{
scenes: {}
}>>();
});
```
sincev4000.0
rng?: RNGConfig
Random generator to be used by the game.
You can select one of the three built-in random generators: "lce", "xorshift32", or "alea".
The default is the linear congruential engine, "lce".
To pass a custom seed, use an RNGConfig object:
```ts
buildnana({
rng: {
type: "alea",
seed: ["buildnana", "rocks", "hard"],
},
});
```
When using the Alea algorithm, provide three string seeds to ensure good entropy.
You can also use a custom generator that satisfies the `RandomGenerator` interface.
sincev4000.0