Join Kelley Hecker for an in-depth discussion in this video Swap pieces, part of Building a Match 3 Game with Unity.
- [Voiceover] Now that we can fill our board with pieces,…we need to be able to match and clear them.…A player clears a piece by swapping it…with an adjacent piece…to match three or more pieces of the same color.…They swap a piece by clicking and dragging…from one piece to another.…To detect mouse clicks, we need to add a collider…to our game piece.…Drag the NormalPiece PreFab into the scene.…From the Component menu, select Physics 2D, Box Collider.…
This box collider will allow us to detect mouse clicks…on the piece.…The collider is represented by this green box.…Since our sprites are anchored to the top-left corner,…we'll need to offset it.…Setting the x offset to .5 in the inspector…and the y offset to negative .5…aligns the collider with our sprite.…It the inspector, hit Apply to apply this…to all our our prefabs.…And then go ahead and delete the object from the scene.…
Open the GamePiece script, and we're going to add…some functions to detect mouse clicks.…These functions are OnMouseDown, OnMouseEnter,…and OnMouseUp.…
Game developer Kelley Hecker covers topics like creating a grid-based game board, using inheritance to create different types of game pieces, adding obstacles and new levels, detecting matches and clearing pieces, and implementing a user interface complete with a score screen. By the end of the course, members will have a completed game and learned new techniques to apply to their next Unity project.
- Creating a game board grid
- Creating and scripting game pieces
- Filling the board
- Creating obstacles
- Swapping pieces
- Matching pieces
- Clearing obstacles and pieces
- Creating new levels
- Creating the user interface: HUD, game over screen, etc.
Skill Level Intermediate
Unity 5: 2D Essential Training (2015)with Jesse Freeman3h 22m Intermediate
Creating Mobile Games with Unitywith Kelley Hecker1h 12m Intermediate
Build a Real-Time Strategy Game with Unity 5with Dan Violet Sagmiller3h 47m Intermediate
1. The Game Board
2. Make a Move
3. Special Piece Types
4. Level Types
5. User Interface
Next steps1m 29s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.