Flash Game: VampBuster

VampBuster is a game that I’d developed under Macromedia Flash 8.
Vampires randomly appears on the jungle, its fly on three different row, (upper, middle, lower).
You have to protect yourself against the vampires using the sling shot and garlic. There are two type of garlic, the smaller one is moves slowly towards the vampires and the bigger one moves faster. Each vampire you miss to hit will draw blood from you and you only have 20 health points, if your HP drops to zero the game will be over. There are 3 kind of vampire, the small one moves faster and scores 30 points when hit, the medium size scores 15, and the large vampire is slower and scores 10 points.
Every time you score 100 points the vampire speed level will increase.

This is my first ever flash game that I developed. I’d use this as my portfolio when I was applying for Game Developer in my current employment. So, pardon me for my laziness on my coding.

On this article we will discussing some basic ActionScript classes, functions and properties.
First thing is to have our images. You can import files you want to use for your application from the menu.
File -> Import -> Import to Library
or you can also create your own directly into Flash Authoring Platform.

Let us start by modifying our mouse cursor. Drag an image from the Library into the stage. In this case we”ll be using the sling shot. Right-click on that image and select Convert to Symbol.

On the Convert to Symbol Window, type sling_shot_mc on the Name field and select Movie Clip for the Type. And for the Linkage select Export for ActionScript and type sling_shot_mc for Identifier.

The Identifier is the linkage name of the movie clip symbol in the library to be attach to another movie clip on the Stage. Click Free Transform Tool on Tools or press (Q) and select the sling shot movie clip. Then rotate the sling shot to 90 degree clock-wise to serves it tip as the pointer.
And resize it to make it appropriate for a cursor.

From the Library Window, drag on the stage an image you want to be the vampire on your application.
Right-click on that image and select Convert to Symbol.
Type vamp1_mc on the Name Field and select Movie Clip for the Type. And for the Linkage select Export for ActionScript and type vamp1_mc for Identifier.
A vamp1_mc symbol is created on the library, right-click on that and make 2 duplicate of it.
Rename the duplicate vamp1_mc symbol and its Identifier to vamp2_mc and vamp3_mc.
Change the Width and Height for each 3 vampire movie clip so we can identify physically each one of them.
For the remaining images do the same procedure for converting and naming.
Delete all the items on the Stage specially the vampires movie clips and the sling shot movie clips, since we will attach them on the stage through ActionScript.

Add a Layer and name it as Rows. On this layer draw 3 rectangle for the hidden path way of the vampires and the garlic.
Make the rectangles inner fill transparent. Convert those into a movie clip with the instance name of row1_mc, row2_mc and row3_mc.
And add another layer below the Rows layer, name it as Background and drag a background like a jungle or any environment you like.

Click Text Tool or press (T) and add 3 Dynamic Text on the stage and name it instances as txtLevel, txtLife, and txtScore.
And also place the garlic on the stage out side the hidden rows.

Now that our stage is set-up, lets do our magic.
Click on menu bar Window > Actions or press (F9) to open the Actions Window.
Define our global variables.

// Define global variables
_global.score = 0;
_global.level = 0;
_global.life = 20;
_global.cDepth = 100;
txt_level.text = 1;
txt_life.text = "20 / 20";

// Custom Mouse Cursor
this.attachMovie("sling_shot", "cursor_shot", this.getNextHighestDepth());
cursor_shot.onMouseMove = function() {
this._x = _xmouse;
this._y = _ymouse;

function randRange(minNum:Number, maxMax:Number):Number {
return (Math.floor(Math.random()*(maxNum-minNum+1))+minNum);

this.onEnterFrame = function() {
// game over
if (_global.life <= 0) { unloadMovie(this); loadMovie("gameover.swf",this) } // add vampire randomly if (randRange(0,20) == 0) { var randomVamp:Number = randRange(1,3); var thisVamp:MovieClip = this.attachMovie("vamp"+randomVamp+"_mc","vampire"+_global.cDepth+"_mc",_global.cDepth); _global.cDepth++; thisVamp._x = -thisVamp._width; // var scale = randRange(80,100); switch (randomVamp) { case 3: thisVamp.points = 10; thisVamp.speed = 3; break; case 2: thisVamp.points = 15; thisVamp.speed = 4; break; default: thisVamp.points = 30; thisVamp.speed = 5; break; } // translucent effect thisVamp._xscale = scale; thisVamp._yscale = scale; thisVamp._alpha = scale; thisVamp.speed += randRange(0,3)+_global.level; // vampire row placement switch (randRange(1,3)) { case 3: thisVamp._y = 10; break; case 2: thisVamp._y = 95; break; default: thisVamp._y = 180; break; } thisVamp.onEnterFrame = function() { this._x += this.speed; if (this._x>row1_mc._width) {
txt_life.text = _global.life+" / 20";
// scoring
if (this.hitTest(garlic1) || this.hitTest(garlic2) {
_global.scorce += this.points;
_global.level = int(_global.score/100)+1;
txt_score.text = _global.score;
txt_level.text = _global.level;

garlic1_mc.onPress = function() {
this.hold = true;
garlic1_mc.onRelease = function() {
// garlic row placement
if (this.hitTest(row1_mc) {
this._y = 25;
} else {
if (this.hitTest(row2_mc) {
this._y = 105;
} else {
this._y = 195;
this.hold = false;
garlic1_mc.onEnterFrame = function() {
if (!this.hold) {
if (this.hitTest(row1_mc) || this.hitTest(row2_mc || this.hitTest(row3_mc)) {
this._x -= 5;
// play the garlic1_mc movie clip

// replacing garlic
if (this._x < 0 || this._y < 0) {
this._x = 546.9;
this._y = 262.9;

garlic2_mc.onPress = function() {
this.hold = true;
garlic2_mc.onRelease = function() {
if (this.hitTest(row1_mc)) {
this._y = 15;
} else {
if (this.hitTest(row2_mc)) {
this._y = 105;
} else {
this._y = 185;
this.hold = false;
garlic2_mc.onEnterFrame = function() {
if(!this.hold) {
if (this.hitTest(row1_mc) || this.hitTest(row2_mc) || this.hitTest(row3_mc)) {
this._x -= 20;
if (this._x < 0 || this._y < 0) {
this._x = 589;
this._y = 256;

One thought on “Flash Game: VampBuster

  1. Alfie says:

    Your current article provides proven beneficial to me. It’s really informative and you are
    certainly very well-informed in this region.
    You have opened my own eyes to be able to different opinion
    of this matter together with intriguing, notable and reliable written content.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s