Placing and moving the cannon

We are shooting bubbles with the cannon, so it will be the first thing to be added in the game.

The idea: The cannon must be placed in the bottom of the screen, in the middle of the game field. Players will be able to rotate it with LEFT and RIGHT arrow keys.

The development: Before we start coding we have to create Main class.

Without closing puzzlebobble.fla, create a new file and from New Document window select ActionScript 3.0 Class. Save this file as in the same path you saved puzzlebobble.fla.

At this time we'll also import all required classes, like KeyboardEvent and Event.

I am going to store into two constants the rotation speed of the cannon and the radius of the bubbles, as I know I'll be using these ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.