A Beginner's Guide to 2D Puzzle Games with Unity (Book)
Create 2D Puzzle Games
In this book, you will get started with creating four different types of puzzle games. The book provides an introduction to 2D puzzle games , and it explains how to use C# in order to create four addictive types of puzzle games including: word games (i.e., hangman), memory game (i.e., simon game), card matching game, and a puzzle.
What you will Learn
After completing this book you will be able to:
- Write code in C#.
- Four types of puzzle games.
- Implement interesting game mechanics (i.e., shuffle cards, reproduce a sequence of sounds and colors, drag and drop cards, etc).
- Complete four puzzle games from start to finish.
Topics covered in this book:
Topics covered in this book include:
- Reading text from a text file
- Choosing random words
- Detecting keyboard inputs
- Creating and using prefabs.
- Creating a user interface.
- Using Audio for background music or special effects.
- Managing score.
- Generating random numbers.
- Creating a word game.
- Creating a card game.
- Creating a puzzle.
- Creating and moving the pieces of a puzzle.
If you would like to start scripting with 2D puzzles in Unity but do not know how, then this book should be very helpful. This is a perfect introduction to 2D game creation and it will provide you with solid foundations to understand and use C# to create simple 2D games.
- Create a 2D puzzle game.
- Learn to code in C#
- Quizz at the end of each chapter
- Code solutions provided
- Chapter 1, Creating a Word Guessing Game, shows you how to create a simple word guessing game where the player has to find the letters that make-up a word chosen at random. You will learn to create a user interface for the game, to read words from a text file, and to pick one word from the file randomly. You will also learn how to process the player's input.
- Chapter 2, Creating a Memory Game, shows you how to create a game where the player has to memorize and play an increasing sequence of colors and sounds, in a similar way as the Simon game that was popular in the 80s. You will learn how to create and generate audio within Unity and change sounds' frequency, to detect when a player has pressed a button, to generate colors at random, and also to record the sequence entered by the player and then compare it to the correct sequence.
- Chapter 3, Creating a card Guessing Game, shows you how to create a card game where the player has to match and to memorize their location. You will learn how to change the texture of a sprite at run-time, check when two cards picked by the player are similar, and also how to shuffle cards.
- Chapter 4, Creating a Puzzle Game, shows how to create a puzzle game where the player needs to move pieces in the right location to complete a puzzle. Along the way, you will learn how to slice an image into several sprites (i.e., pieces) to create puzzle pieces from an image of your choice, and how to shuffle these puzzle pieces; you will also learn how to make it possible for the player to move (i.e., drag and drop) these pieces, to make these pieces 'snap' to a particular location, and to detect when the player has dragged and dropped a piece to the correct location.
- Chapter 5 provides answers to Frequently Asked Questions (FAQs) related to the topics covered in this book.
- Chapter 6 summarizes the topics covered in the book and provides you with more information on the next steps.
Patrick Felicia is a lecturer and researcher at Waterford Institute of Technology, where he teaches and supervise undergraduate and postgraduate students. He obtained his MSc in Multimedia Technology in 2003 and PhD in Computer Science in 2009 from University College Cork, Ireland. He has published several books and articles on the use of video games for educational purposes, including the Handbook of Research on Improving Learning and Motivation through Educational Games: Multidisciplinary Approaches (published by IGI), and Digital Games in Schools: a Handbook for Teachers, published by European Schoolnet. Patrick is also the Editor-in-chief of the International Journal of Game-Based Learning (IJGBL), and the Conference Director of the Irish Symposium on Game-Based Learning, a popular conference on games and learning organized throughout Ireland.