Book Image

Flash Game Development by Example

By : Emanuele Feronato
Book Image

Flash Game Development by Example

By: Emanuele Feronato

Overview of this book

<p>You can't call yourself a Flash game developer unless you know how to build certain essential games, and can quickly use the skills and techniques that make them up.<br /><br />Flash Game Development by Example is an ultra-fast paced game development course. Learn step-by-step how to build 10 classic games. Each game introduces new game development skills, techniques, and concepts. By the end of the book you will have built ten complete games &ndash; and have the skills you need to design and build your own game ideas.<br /><br />The book starts with simple well known puzzle games: Concentration and Minesweeper. After learning the basics of game design you&rsquo;ll introduce AI with a four-in-a-row game. Then as you build your own versions of old arcade games such as Snake, Tetris, and Astro Panic. The book ends with a collection of modern casual classics.</p>
Table of Contents (17 chapters)
Flash Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Where to Go Now
Index

Placing the gems for real


Preventing the game field from starting with successful streaks means coding all the required routines to see if a given gem is part of a successful streak. There is a lot to code, but the good news is the functions to check for successful streaks that we are about to write are the same as we will use when the player starts swapping gems.

The idea: When it's time to place a gem, check if the gem we are about to place will form a successful streak. In this case, keep generating random gems until it's no longer part of a streak. Finally place the gem.

The development: Checking for a successful streak is not different from checking for victory in Connect 4. We can even say it's easier since we only have to look horizontally and vertically, without caring about diagonals.

Following the concepts seen during the making of Connect 4, let's start creating some basic functions.

The first function we need is one that tells us if there is a certain gem in a given row and column...