Controls
Create a group to handle the controls for the game
Create a group to handle the controls for the game
At the moment our game will destroy the element if it is over the trash can.
At the moment our game will destroy the element if it is over the trash can.
It does NOTHING if it is placed anywhere else.
It does NOTHING if it is placed anywhere else.
We will now write a function to update the element once it is dropped.
We will now write a function to update the element once it is dropped.
Concept:
Concept:
The player drags an element and drops it on the game board
The player drags an element and drops it on the game board
Now we must:
Now we must:
- Check if it is overlapping another element
- If it is overlapping another element we need to check if they can merge
- If they can merge we need to create a new merged element at that position
- Create some particle effects for visual appeal
Player drops Earth and Fire
Player drops Earth and Fire
We create an invisible purple square called the "Reader" at the overlap position
We create an invisible purple square called the "Reader" at the overlap position
If the two elements fall within the boundary of the square and they can merge
If the two elements fall within the boundary of the square and they can merge
We destroy the elements and spawn a new element (lava) at their position.
We destroy the elements and spawn a new element (lava) at their position.
We have to check all the possible matches!
We have to check all the possible matches!
Add a new function to our functions group called ReadPosition
Add a new function to our functions group called ReadPosition
Once we have checked the merge and spawned the new element we can destroy the reader.
Once we have checked the merge and spawned the new element we can destroy the reader.
Now we must update our Controls Group Code
Now we must update our Controls Group Code
Now test the game and check that merges work
Now test the game and check that merges work