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

Drawing the game field


Although it's not necessary to literally "draw" the game field, doing it will help us to deal with this particular kind of tile-based game. We know we are dealing with hexagonal tiles, but since hexagons can be drawn inside a circle, we will simplify the script drawing circular tiles.

The idea: We will draw on the stage the circular tiles that will define the game field. This will make us see where bubbles should be placed.

The development: As usual we need a DisplayObject to act as a container for everything related to game field. A new class level variable called bubCont will do this job:

private const ROT_SPEED:uint=2;
private const RADIUS:uint=18;
private var cannon:cannon_mc;
private var left:Boolean=false;
private var right:Boolean=false;
private var bubCont:Sprite;

Then the first thing Main function has to do is placing the container. We'll delegate this task to a function called placeContainer.

public function Main() {
  placeContainer();
  ...
}

placeContainer...