Game Development Reference
In-Depth Information
Game ScoreBoard constants
We will need to create a single element on our
scoreBoard
object to hold the number of times the
player has clicked the mouse. We will always create constants in the
Main.as
class to handle the
scoreBoard
elements. The constant for this element will be called
SCORE_BOARD_CLICKS
.
Creating the Main.as class
Let's get to the goods now. After the next few pages, you will have created your first game within
the framework and will be ready to create the rest of the games in this topic. We covered creating
a project for two different development environments earlier in this chapter. If you have not
created the
Main.as
class file yet, it is time to do so. You will need to create a
Main.as
class and
save it in the project folder for your chosen development environment:
In the Flash IDE, your folder structure will look something like the following:
[source]
[projects]
[stubgame]
[flashIDE]
[com]
[efg]
[games]
[stubgame]
Main.as
Using the Flex SDK (that is, Flash Develop), your structure will look like this:
[source]
[projects]
[stubgame]
[flexSDK]
[bin]
[obj]
[lib]
[src]
[com]
[efg]
[games]
[stubgame]
Main.as
Here is entire code listing for this class:
package com.efg.games.stubgame
{
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.geom.Point;
import com.efg.framework.FrameWorkStates;
import com.efg.framework.GameFrameWork;
import com.efg.framework.BasicScreen;
import com.efg.framework.ScoreBoard;
import com.efg.framework.SideBySideScoreElement;