Board Setup

With BoardPlugin it is possible to make a variety of board and it's fully customizable.

Types of arguments

You can pass two type of arguments in the board (besides scene which is required as the first argument). They are 'Global' and 'Items' and they both have to be an object.

Global Config

Global is used for control of all board under that instance. To pass a global argument object, there has to be a type parameter set to global.

Global arguments are optional, however, it's needed to control the behavior of board and its items.

example of a global settings object will look like this.

{
  type: 'global',
  isSelectable: true,
  selectAgainst: 1,
  matchAgainst: 1,
  match: 'all'
}

Full list of Global Arguments

Key Type Default Description
type Bool undefined Identifier (please set it to global)
isSelectable Bool true Input controller for the hole
selectAgainst Int 0 The Index of the board from which to choose the item from
matchAgainst Int 0 The Index of the board from which to choose the items from
match String all Customize match (straight or all)
neighbors Obj { side: true, corner: true } get neighbers of a item (set match to straight first')
newItem Obj { x: -150, y: -150 } New item start position
fitScreen Bool false Fit Board, according to screen size
applyScale Bool false Whether to apply scale

WARNING

Avoid mutating property not included in the list.

Items config

Items arguments are for generating boards and it is required to at least pass an empty object to create a board. You can pass this type of arguments as many as you like, It'll simply make boards equal to the number of arguments passed. there's no need for type parameter in items arguments.

example of a items argument.

{
  cols: 6,
  rows: 6,
  items: 'items',
  skipValue: true,
  size: 50,
  maxSize: {
    width: 50,
    height: 100
  }
}

Full list of Items Arguments

Key Type Default Description
cols Int 6 Number of columns in board
rows Int 6 Number of rows in board
min Int 0 Minimum value to choose items from, also use for choosing frame position
max Int Auto Mximum value to choose items from, also use for choosing frame position
depth Int 50 Depth of items
size Number, Object(width, height) Auto Display size for items (minimum is 5)
minSize Number, Object(width, height) Auto Minimum size for items
maxSize Number, Object(width, height) Auto Maximum size for items
scale Number, Object(x, y) 1 Scale of items
margin Number, Object(x, y) 5 Margin between items
offset Number, Object(x, y) 0 Offset items (based on parent)
parent Int null Index of allready existing board
items String, Object, Array graphics To generate items. Can be a Array containing sprite names, or a object containing spriteAtlas name as key and an aray containing frame names as value, or a spritesheets name
graphics String, Array rectangle Can be a single or a array containing multiple geometry name. currently supports 'triangle', 'circle', 'rectangle'
color String, Array 0xeeeeee Color for items, also can be array with muliple colors
borderColor String, Array color Border color for items, also can be array with muliple colors
skipAll Bool false If set to true, creates a board with empty objects
skip Array false A array containing skip positions(In object format). example - {start: {c: 0, r: 0}, end: {c: 0, r: 0}}
skipValue Bool false Sets all items value to null
chance Int 100 Probability of item creations
excludeValue Array [ ] Probability of item creations
includeValue Array [ ] Probability of item creations
includeChance Array [ ] Probability of item creations
reserve Int 0 Number of items to create for later use
callback function - Callback function, called after every item creation. expected args (createdItem, col, row)

Screenshots

simple