BHT Sliding Puzzle
This plugin provides the engine for a standard bubble-shooter style game.
Introduction
The plugin lets the user push a data structure that matches the GUI elements of a bubble-shooter style game, and then manages all of the complicated trajectory and colision detection for a shooter-ball, at a given angle, moving along the trajectory, including bouncing off of the edge of the game play area, and finally ending at a given cell location. Subsequent calls tell the user which cells are adjacent to the landing position. It also finds any cells that are isolated and no longer adjacent to any other cells - these need to be eliminated also.
The game can either be a Regular pattern, where even and odd rows have the same number of cells in the row. Alternately, since even rows are staggered from the odd rows, you can also have an Irregular style, where the even rows have one less cell than the odd rows. (Bubble Shooters have a regular pattern, where as, something like "Panda Pop", has an Irregular pattern).
There are many expressions for getting different data about a given cell, and for converting from cell coordinates to physical pixel positions.
***Does not support the C2 Save/Load mechanism, at this time.
Installing
Drag the C2ADDON file onto the Construct GUI to install the plugin.
Properties
Hotspot
The location of the hot spot in the object.
Row style
This specifies if the rows are configured with the same number of columns (Regular), in even and odd rows, OR if even rows have one less column (Irregular).
Columns
The number of columns of tokens in the game.
Rows
The number of rows of tokens in the game.
Token radius
The radius of the token object, in pixels.
Callbacks
Set to one to support callbacks on cell-intersections and line-segments, for debugging purposes.
Show outline
Show the outline of the grid for debugging purposes.
Conditions
Are cell coordinates valid
Is the given (X,Y) a valid cell index.
Expressions
Bubble Shooter
Get Cell Data
Return the data at index (x,y,z).
Get cell X position by index
Return the X position given (x,y).
Get cell Y position by index
Return the Y position given (x,y).
Get cell X index by position
Return the X index given position (x,y).
Get cell Y index by position
Return the Y index given position (x,y).
Get the X target index
Return the X index of the final targetted cell.
Get the Y target index
Return the Y index of the final targetted cell.
Get length of line-segment array
Return the length of the line-segment array.
Get the X index of the line-segment array by index
Return the X index of the line-segment array given (i).
Get the Y index of the line-segment array by index
Return the Y index of the line-segment array given (i).
Get number of eliminated cells
Return the number of cells that were flagged as 'eliminate'.
Get number of detected cells
Return the number of cells that were flagged as 'detect'.
Is the given cell adjacent to any other cells with the given colour
Return 1 if the cell is adjacent to the given colour.
Get the number of columns
Return the number of columns in the grid.
Get the number of rows
Return the number of rows in the grid.
Get the cell radius
Return the radius of the cell.
Get the play area width
Return the play area width. (Deals with staggering).
Get the play area height
Return the play area height. (Deals with staggering).
Debug
Get length of cell-intersection array
Return the length of the cell-intersection array.
Actions
Bubble Shooter
Populate cell data
Populate the given cell array with user data. Z=0 is always the token data, -1 is empty.
Isolate
Find any cells that are isolated (have no adjoining neighbours).
Eliminate
Find all adjoining neighbour cells with the given ID/colour). Sets that cell's detection state.
Clear Detection state
Clear the detection level of the data array.
Detect adjacent by ID
Set the detection flag for any cell with the given ID/colour that is adjacent to given cell.
Configure game settings
Set the game style, grid dimensions, and cell radius.
Debug
Dump
Dump the cell array to the console.
Availability