Last updated: 12/15/2016
Categories > Board > BejeweledRelated pluginsFlow chartState matchine of mainState matchine of MATCH3State machineMain state machineSub state machine match3Symbol of tileHow to
Event sheets
Event sheets
OFF
Event sheet: FSM-main
Initial state
Steps
START
Event sheet: FSM-main, Board
Steps
Fill tiles
Call "Board.Init"
Board size is 10x20, separated in up and down parts
Bottom part:
Top part
Symbol of each chess is its frame index
Chess Condition: On created
Go to RESET
RESET
Event sheet: FSM-main, Board
Fill chess and exclude all match3 lines
Steps
Call "Board.Reset"
Destroy all chess
Fill empty cells
Call "Board.Fill"
Exclude all match3 lines
Call "Boad.BreakMatch3"
For each match3 line (tiles)
Go to HAS_POSSIBLE_MATCH3
HAS_POSSIBLE_MATCH3
Event sheet: FSM-main, Board
Test if there has any possible match3 line after swapped
Steps
Call "Board.HasMatch3AfterSwapped"
For each chess
Call "testSwap"
, has match3 after swapped with its right neighbor?
Call "testSwap"
, has match3 after swapped with its right neighbor?
Stop testing when found a possible match3
If found a posible match3
SELECT_1
Event sheet: FSM-main
Get chess_uid1
from input (touch)
Steps
On touch
chess_uid1
SELECT_2
Event sheet: FSM-main
Get chess_uid2
from input (touch), and make sure chess_uid1 and chess uid2 are neighbors
Steps
On touch end
Set chess_uid2
If chess_uid1
and chess uid2
are neighbors
SWAP
Event sheet: FSM-main
Swap chess_uid1
and chess_uid2
Steps
chess_uid1
and chess_uid2
MATCH3
Event sheet: FSM-main, FSM-match3
Run sub state machine match3 until finished
Steps
Invoke sub state machine match3, with callback On function "FSM.main.MATCH3.request"
On function "FSM.main.MATCH3.request"
, to get total matched lines
If amount of total matched lines = 0
UNDO_SWAP
Event sheet: FSM-main
Swap chess_uid1
and chess_uid2
Steps
chess_uid1
and chess_uid2
START
Event sheet: FSM-match3
Initial variables
Steps
total_matchedlines
= 0MATCH3
Event sheet: FSM-match3-MATCH3
Get matched lines
Steps
Set matchedline
= 0, which is the index of matched lines
Get matched lines in group match-1
...match-matchedline
Pick match5 line. For each match5 line
matchedline
"match-" & match3.matchedlines
Pick match4 line. For each match4 line
If this line is Not a sub set of current matched lines (A match5 contains 2 match4 lines)
matchedline
"match-" & match3.matchedlines
Pick match3 line. For each match3 line
If this line is Not a sub set of current matched lines (A match4/match5 contains 2/3 match3 lines)
matchedline
"match-" & match3.matchedlines
(Optional) Get intersection chess of matched lines
For each 2 matched lines i and j
Set group "intersect" is line i AND line j
If group "intersect" is not empty
If matchedline
= 0
ELIMINATION
Event sheet: FSM-match3-ELIMINATION
Destroy matched chess
Steps
FALL
Event sheet: FSM-match3-FALL
Fall down all chess
Steps
Call "Bord.Fall"
, with callback On function "match3.OnFallComplete"
For each cell, bottom to top
Pick chess
(Move down chess if possible) If can move down
Grid move condition:On hit target
Wait event condition:On all event finished
On function "match3.OnFallComplete"
FILL
Event sheet: FSM-match3
Fill empty cells
Steps
Call "Board.Fill"
END
Event sheet: FSM-match3
Invoke callback
Steps
Call match3.callback
Event sheet: Board, Matcher condition:On get symbol
Change board size
Width
, Height
of board objectControl the frame of new chess
Chess Condition: On created
Select two swapping chess
Symbol of tile
Matcher condition:On get symbol
Add matching rules
Add chess elimination rules
Modify chess falling