A Beginner's Guide to Puzzle Games: Beginners' Guides, #3
()
About this ebook
Newly Edited and Updated Version
Master 2D Puzzle games with Unity
Without this book, most people spend too long trying to create 2D puzzle games the hard way. This book is the only one that will get you to create puzzle games, word games, and card games without wasting so much time. It includes six chapters that painlessly teach you the necessary skills to get started with 2D games and implement the gameplay that you need to create entertaining casual games that you could publish online.
What you will learn
After completing this book, you will be able to create entertaining 2D puzzle games. Along the way you will also learn to:
- Improve your Unity and C# skills.
- Combine variables, functions, loops, and conditional statements to create the structure of your game.
- Create and modify the user interface from a script (e.g., splash-screen, score, cards, letters, sound, etc.).
- Create and handle important events such as drag, drop, click, etc.
- Change the texture of a sprite at run-time.
- Create mechanisms that make it possible for the player to move (i.e., drag and drop) 2D objects, 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.
Content of the book
The content of the book is as follows:
- In Chapter 1 you will create a word guessing game with high replay value where the player has to find the letters that make-up a word
chosen at random from a text file that includes thousands of possible words to guess.
- In Chapter 2 you will learn to create a game where the player has to memorize and to 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 the 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. Along the way, you will also learn and apply the concept of finite state machine, which is very important in computer science.
- In Chapter 3 you will create a card game where the player has to match cards after memorizing their location. You will also detect and manage mouse events.
- In Chapter 4 you will create a puzzle game where the player needs to move pieces in the right location to complete a puzzle. You will also learn how to easily modify the image of the puzzle to make it your own without changing a line of code.
- Chapter 5 provides answers to frequently-asked questions.
If you want to learn how to code in C# while creating 2D games with Unity using a tried-and-tested method: download this book now!
Patrick Felicia
Patrick Felicia is a lecturer and researcher at Waterford Institute of Technology, where he teaches and supervises 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.
Related to A Beginner's Guide to Puzzle Games
Titles in the series (3)
A Beginner's Guide to 2D Platform Games with Unity: Beginners' Guides, #1 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Shooter Games: Beginners' Guides, #2 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to Puzzle Games: Beginners' Guides, #3 Rating: 0 out of 5 stars0 ratings
Related ebooks
A Beginner's Guide to 2D Platform Games with Unity: Beginners' Guides, #1 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Shooter Games: Beginners' Guides, #2 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Beginner): Unity from Zero to Proficiency, #2 Rating: 5 out of 5 stars5/5Unity from Zero to Proficiency (Intermediate): Unity from Zero to Proficiency, #3 Rating: 2 out of 5 stars2/5Unity from Proficiency to Mastery (Artificial Intelligence): Unity from Proficiency to Mastery, #1 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Advanced): Unity from Zero to Proficiency, #4 Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Beginner): Godot from Zero to Proficiency, #2 Rating: 5 out of 5 stars5/5The Ultimate Guide to 2D games with Unity: Ultimate Guides, #2 Rating: 0 out of 5 stars0 ratingsA Quick Guide to Artificial Intelligence with Unity: Quick Guides, #4 Rating: 0 out of 5 stars0 ratingsGetting Started with 3D Animation in Unity: Getting Started, #1 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Proficient): Unity from Zero to Proficiency, #5 Rating: 5 out of 5 stars5/5A Quick Guide to Card Games with Unity: Quick Guides, #5 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Foundations) Fifth Edition: Unity from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5Unity from Proficiency to Mastery (C# Programming): Unity 5 from Proficiency to Mastery, #2 Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Advanced): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5A Quick Guide to Procedural Levels with Unity: Quick Guides, #2 Rating: 5 out of 5 stars5/5Mobile Game Design Essentials Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Intermediate): Godot from Zero to Proficiency, #3 Rating: 5 out of 5 stars5/5Video Game Careers - Beginners Guide: Video Game Careers, #1 Rating: 0 out of 5 stars0 ratingsCreating ELearning Games with Unity Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Proficient): Godot from Zero to Proficiency, #5 Rating: 5 out of 5 stars5/5Unity Game Development Blueprints Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Foundations): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5Building an RPG with Unreal Rating: 0 out of 5 stars0 ratingsA Comprehensive Guide to Video Game Design Schools Rating: 0 out of 5 stars0 ratingsA Quick Guide to 2d Infinite Runners with Unity: Quick Guides, #3 Rating: 0 out of 5 stars0 ratingsGameMaker Cookbook Rating: 0 out of 5 stars0 ratingsUnity Animation Essentials Rating: 0 out of 5 stars0 ratingsSFML Game Development By Example Rating: 0 out of 5 stars0 ratings
Programming For You
Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Java for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Python Machine Learning By Example Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsWeb Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5101 Amazing Nintendo NES Facts: Includes facts about the Famicom Rating: 4 out of 5 stars4/5OneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratings
Reviews for A Beginner's Guide to Puzzle Games
0 ratings0 reviews
Book preview
A Beginner's Guide to Puzzle Games - Patrick Felicia
Create simple 2D puzzle games and learn to code in the process
Patrick Felicia
A Beginner’s Guide to
2D Puzzle Games
with Unity
Copyright © 2017 Patrick Felicia
All rights reserved. No part of this book may be reproduced, stored in retrieval systems, or transmitted in any form or by any means, without the prior written permission of the publisher (Patrick Felicia), except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either expressed or implied. Neither the author and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
First published: March 2017
Published by Patrick Felicia
Credits
Author: Patrick Felicia
About the Author
Patrick Felicia is a lecturer and researcher at Waterford Institute of Technology, where he teaches and supervises 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 Conference on Game-Based Learning, a popular conference on games and learning organized throughout Ireland.
Support and Resources for this Book
To complete the activities presented in this book you need to download the startup pack on the companion website; it consists of free resources that you will need to complete your projects, including bonus material that will help you along the way (e.g., cheat sheets, introductory videos, code samples, and much more).
Please open the following link: http://learntocreategames.com/books/
Select the corresponding book.
On the new page, click on the link labelled Book Files
, or scroll down to the bottom of the page.
In the section called "Download your Free Resource Pack, enter your email address and your first name, and click on the button labeled
Yes, I want to receive my bonus pack".
After a few seconds, you should receive a link to your free start-up pack.
When you receive the link, you can download all the resources to your computer.
This book is dedicated to Helena
––––––––
[ ]
Table of Contents
1 Creating a Word Guessing Game
Creating the interface for the game
Detecting and processing the user input
Choosing random words
tracking the score and the number of attempts
Choosing words from a file
Level Roundup
2 Creating a Memory Game
Introduction
Creating the interface and the core of the game
Detecting when buttons have been pressed
Managing the game
Handling clicks
Creating different states for our game
Playing a sequence of colors
Creating a new sequence of colors
Waiting for the user’s input
Processing the user’s input
Generating sound effects
Level Roundup
3 Creating a Card Guessing Game
Introduction
Setting-up the interface
Creating a game manager
Adding multiple cards automatically
Associating the correct image to each card
Shuffling the cards
Allowing the player to choose cards from each row
Checking for a match
Level Roundup
4 Creating a Puzzle Game
Introduction
Creating and moving a piece of the puzzle
Dropping the tile to a placeholder
Using multiple placeholders
Using and slicing a full image to create the puzzle pieces
Generating sprites at run-time
Level Roundup
5 Frequently Asked Questions
Accessing Resources
Detecting user inputs
6 Thank you
Preface
After teaching Unity for over 5 years, I always thought it could be great to find a book that could get my students started with Unity in a few hours and that showed them how to master the core functionalities offered by this fantastic software.
Many of the books that I found were too short and did not provide enough details on the reasons behind the actions recommended and taken; other books were highly theoretical, and I found that they lacked practicality and that they would not get my students’ full attention. In addition, I often found that game development may be preferred by those with a programming background, but that people with an Arts background, even if they wanted to get to know how to create games, often had to face the challenge of learning to code for the first time.
As a result, I started to consider a format that would cover both aspects: be approachable (even to the students with no programming background), keep students highly motivated and involved using an interesting project, cover the core functionalities available in Unity to get started with game programming, provide answers to common questions, and also provide, if need be, a considerable amount of details for some topics.
I then created a book series entitled Unity From Zero to Proficiency that did just that. It gave readers the opportunity to discover Unity’s core features, especially those that would make it possible to create an interesting 3D game rapidly. After reading this book series, many readers emailed me to let me know how the book series helped them; however, they also mentioned that they wanted to be able to create a simple game from start to finish, publish it and share it with their friends.
This is the reason why I created this new book series entitled "A Beginner’s guide"; it is for people who already have completed the first four books in the series called Unity From Zero to Proficiency, and who would like to focus on a particular aspect of their game development. This being said, this new book series assumes no prior knowledge on the part of the reader, and it will get you started quickly on a particular aspect of Unity.
In this book, focused on 2D puzzle games, you will be completing four 2D puzzle games and also code in C#. By completing each chapter, and by following step-by-step instructions, you will progressively create four complete 2D puzzle games and learn more about C# programming in the process.
You will also create a 2D game that includes many of the common techniques found in puzzle games including: generating random words or cards, making it possible for the player to drag and drop pieces (e.g., cards), playing and recording a sequence of keys pressed by the player, playing sound effects, processing users’ choices, or keeping track of the score.
[ ]
Content Covered by this Book
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 to 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 the 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 cards after memorizing 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 this book and provides you with more information on the next steps.
What you Need to Use this Book
To complete the project presented in this book, you only need Unity 5.5 (or a more recent version) and to also ensure that your computer and its operating system comply with Unity’s requirements. Unity can be downloaded from the official website (http://www.unity3d.com/download), and before downloading it, you can check that your computer is up to scratch on the following page: http://www.unity3d.com/unity/system-requirements. At the time of writing this book, the following operating systems are supported by Unity for development: Windows XP (i.e., SP2+, 7 SP1+), Windows 8, and Mac OS X 10.6+. In terms of graphics card, most cards produced after 2004 should be suitable.
In terms of computer skills, all knowledge introduced in this book will assume no prior programming experience from the reader. So for now, you only need