Fire Storm 2

November 7th, 2008

check it out: http://www.freewebs.com/miked-games/fire_storm2.htm

Multi-Dimensional Arrays in Flash

October 16th, 2008

Arrays make a great way to store and manage data in actionscript. However, sometimes just a single dimension may not be adequate for some situations such as when storing table data. Then you will need to either: define an array for each column for every row, or just make a one two-dimensional array.

A two-dimensional array can be thought of an array nested in an array. To instantiate an array, we can either do:

var arr1:Array = new Array(1, 2, 3);
var arr2:Array = new Array(4, 5, 6);
var arr3:Array = new Array(7, 8, 9);
var arr:Array = new Array(arr1, arr2, arr3);

Or the quicker way:

var arr:Array = new Array([1, 2, 3], [4, 5, 6], [7, 8, 9]);

All we’re doing here is defining arrays inside of an array. To reference a two-dimensional array is practically the same as a normal array except for we have a second element to reference. This means we just need to add another “[n-1]:”

// Output: 6
trace(arr[1][2]);

To add a new element to the first array, we can use the same syntax as we would with a single-dimension array, but we would be pushing an array data type:

// Adds another element to the outer array
arr.push(arr1);

To add an element to one of our existing arrays, we reference the array’s element in the outer array:

// Ads a sub element to arr1[1] (= 4,5,6)
arr[1].push(arr1);

The rest of the functions in the Array package are used in the same way, but with different references to the caller.

Minigame Arcade 2

October 15th, 2008

I’ve been working on Minigame Arcade 2. I decided to make it because Minigame Arcade needed much improvement, I liked making it, and some people asked for a sequel. So, I decided to make one that would be a lot better than the first.

Features:

  • 12-15 Minigames Total
  • 3-5 Minigames to Unlock
  • 4 Returning Mini-games
  • 4-5 Great Songs
  • 2 Difficulty Modes
  • A Music Menu in every Mini-game
  • A Stats Menu
  • 3 Additional Things to Unlock
  • A Spanish Translation
  • Less Ads
  • No Glitches
  • No Cheats
  • Improved Graphics and Presentation
  • Better Mini-games
  • Sound Effects
  • etc.

More can be read about the progress of the game here: http://chad-duncan.newgrounds.com/news/post/188277.

Array Tutorial

October 15th, 2008

Arrays are very helpful when making games because they are able to hold more than one value unlike normal variables. Using arrays, you can have easy access to a large quantity of information. Arrays are essential to make many types of games and can make your job as a Flash developer easier. This tutorial will attempt to show you how use arrays.

1) Creating an Array

Here is an example of how to create an array:

var myArray:Array = new Array(”value 1″, “value 2″, “value 3″);

First, we give the array a name (like myArray), and then enter values into the array using new Array(). Values in an array can be strings (text), numbers, other arrays, etc.

Here is another example, but with an array becoming the same as another:

var myArray2:Array = myArray;

2) Accessing an Array

Below are examples of how to access an array and values in it:

colors[0] = “red”;

inventory["money"] = 100;

weapons[2] = “Machine Gun”;

var selectedWeapon:String = weapons[5];

You can access the values in an array by using [ ] . You give the number of the element in an array or supply a title. However, the elements in array are numbered beginning with zero instead of one. For example, if you wanted to access the third element of the array, myArray, you would use myArray[2] not myArray[3]. Also, you can put a variable in the [ ]. Example: if currentlevel is 3, levels[currentlevel] could be used to access the third level.

3) Other Things to Know

To get the length of the array use: myArray.length. The function push() can add a value to the end of an array, and unshift() can add it to the end. To remove the last element in an array use pop(), and to remove the first use shift(). You can also use reverse() to reverse the order of the elements in an array. Read more about all this here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html?Array.html&class-list.html.

Conclusion

I hope this tutorial helps. If you don’t understand something or something doesn’t work for you, leave a comment or e-mail me. If you have a suggestion to improve this tutorial, leave a comment.

Beat Machine Released!

August 22nd, 2008

After a looong time, I have finally completed this game. It has dragged on for over a year. It has evolved ever since the ‘Rock Out’ contest from AG more than a year ago. Flash has given a lot of trouble with cross-domain files and compiling correctly. When I first submitted at the beginning of summer, the game was a disaster; I hope that this time it will turn out a little better.

Go Play It!

Enjoy,
.dank

// First post!

Movement with the Keyboard

August 4th, 2008

So you want to move things?

The Script
if(Key.isDown(Key.UP)){
// execute script
}

How Does it Work?
We call isDown (function) and we pass it the value of the key which we want to know is being pressed or not.
It will return a boolean value, true if the key is being pressed, or false if it is not.
We know that an if statement will execute if the value in the ‘()’ is true, so we don’t have to type: if(Key.isDown(Key.UP) == true)

So How Do I Make Stuff Move?!
Why, by simple using a script similar to this: (note: this should be in a movieclip or an enterFrame event)

if(Key.isDown(Key.UP)){
this._y -= 5
}
if(Key.isDown(Key.DOWN)){
this._y += 5
}
if(Key.isDown(Key.RIGHT)){
this._x += 5
}
if(Key.isDown(Key.LEFT)){
this._x -= 5
}

The first if tests the up key, the second tests down, the third right, fourth left.
The this.(_x/_y) (+/-) = 5 adjusts the objects X and Y coordinates moving it around the stage.

If you want to use different keys on the keyboard, you can refer to this chart and use the numbers in place of the Key.* .

Site Almost Finished

July 30th, 2008

I have finished the home, games, tutorials, about, and contact pages. I still need to make a page for the chat. Other than that, I have added the files for the games (except for Castle Resistance), but the way the games are presented may need to be improved. Now, all that is really left to do is add content and polish the site. A few small changes need to be made on certain pages.

Before I forget, I have been working on the game submission system for this site, but it probably won’t be done for a few days (maybe a week).

-Chad

Saving and Loading in Actionscript 2

July 30th, 2008

In this tutorial, I will teach the basics of saving and loading. Flash has the ability to save a small .sol file on the user’s computer using SharedObjects. Each flash file gets its own .sol file to access. The only problem is that a Flash file on one domain can’t use the same SharedObject as the same Flash file on another domain. So, the saved data for a game on one website will be different for another. Besides this, there should be no problems. Knowledge of variables is required before reading this tutorial.

To create the file, call SharedObject.getLocal(). Below is an example:

var game:SharedObject = SharedObject.getLocal("game_data");
game.data.score=score;
game.flush();

In that example, the file was created with line one. On the next line, the variables to be saved were declared. Finally, the file was saved with flush(). Overall, this is self-explanatory.In the next example, data will be loaded. This is similar to saving:

var game:SharedObject = SharedObject.getLocal("game_data");
var score:Number = game.data.score;

This too is self-explanatory. For further information about shared objects visit:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3 /flash/net/SharedObject.html