GameConfig is the object you pass when contructing a new Game.
Hierarchy
- GameConfig
Index
Properties
- clearGrid
- containerId
- create
- defaultDotColor
- frameRate
- gridHeight
- gridWidth
- onDotClicked
- onKeyPress
- update
Properties
Optional
clearGrid
• clearGrid? : undefined | false | true
Specifies whether 24a2 should clear the grid at the beginning of each frame. 24a2 clears the grid by setting the colour of every dot to GameConfig.defaultDotColor. Setting clearGrid to false lets you simplify the code for some games by letting 24a2 store the state for each dot. You can use Game.getDot to read back the colour of dots. By default, this is set to true.
Optional
containerId
• containerId? : undefined | string
The ID of a container to create the canvas in.
Optional
create
• create? : undefined | function
create(game)
is a function which is called once, just before the game
starts running. You can use it to initialise game state, if needed.
Optional
defaultDotColor
• defaultDotColor? : Color
Set the default color of the dots. By default, this is set to Color.Gray.
Optional
frameRate
• frameRate? : undefined | number
Sets the game’s frame rate. By default, this is set to 24.
Optional
gridHeight
• gridHeight? : undefined | number
Sets the height of the grid. By default, this is set to 24.
Optional
gridWidth
• gridWidth? : undefined | number
Sets the width of the grid. By default, this is set to 24.
Optional
onDotClicked
• onDotClicked? : undefined | function
onDotClicked(x, y)
is a function which is called when the player clicks
on a dot.
Optional
onKeyPress
• onKeyPress? : undefined | function
onKeyPress(direction)
is a function which is called when the player
presses one of the arrow keys.
Optional
update
• update? : undefined | function
update(game)
is repeatedly called as the game runs. You can use it to
define the main functionality of your game.