Monday, October 17, 2011

A Hangman Game Sample

I've been getting some good feedback on my hangman tutorial since posting it a few weeks ago.

An example of how it can be used is here as a history quiz: http://flashnhistory.com/MedievalHangman/Hangman.swf

The original tutorial is here: http://www.flashbynight.com/tutes/hangman/

Monday, September 5, 2011

Flash FAQ: Communicating between Classes in AS3

I often answer questions on the forums over at Actionscript.org and I noticed that people are always asking about communicating between classes. In particular, people ask how you can change a variable in the document class (main class) from another class. So instead of repeating myself, I'll post it here.

Short answer:  MovieClip.(this.parent).variable=xxx;

Long Answer:

You have to be careful when you access variables in one class from another class. Things can get confusing pretty quickly. But a good example of when it is kosher is when you have an enemy in a game; when it is hit by a bullet, it tells the document class to increase the score. It's simple and foolproof enough.

Okay, I set up a flash document with Main.as as the document class. I declare an object obj which is an instance of the class Obj. I declare a variable pvar, which we will set to 1 and then set to 2 by running a function in Obj.as:


package  {

import flash.display.MovieClip;


public class Main extends MovieClip {

public var obj:Obj;
public var pvar:int;


public function Main() {
pvar=1;
obj = new Obj;addChild(obj);
obj.ResetVar();
trace(pvar);
}//game
}

}


Can you see that? It's easy to run a function on a separate class... we just say obj.ResetVar();


Of course, we haven't created Obj.as yet, so let's do that now:


package {
import flash.display.MovieClip;
public class Obj extends MovieClip {


public function Obj() {}//Obj


public function ResetVar(){
MovieClip(this.parent).pvar=2;
}//rv


}
}


Now you can see how we use the line MovieClip(this.parent).pvar=2; to refer to the parent of this movie clip and set pvar to 2.

Try it and you should get the trace '2'.

Got it? Good.

If you have any questions or the explanation isn't clear, please feel free to leave a comment. If you're looking for some more Flash tutorials or projects, try here: flashbynight.com/tutes

Sunday, September 4, 2011

Things Fall Down

Time for a new Flash game and I hope you like it.

In Things Fall Down, the sky is falling and everything else along with it. Keep jumping up and keep yourself above ground.

There are fifteen short levels that would probably take around one hour to finish.

The game is at: http://www.flashbynight.com/thingsfalldown

Have a look at some screenshots here:



If you've played some of my games before, you'll recognise the graphical style. Enjoy!


Friday, June 10, 2011

New Tute! Guide to coding a hangman game.

Here is a step-by-step guide to creating a hangman game in Flash CS5 with AS3. Feel free to play around with the code:

http://flashbynight.com/tutes/hangman

Here is a downloadable pdf version:

http://www.scribd.com/doc/57512256/Create-a-HangMan-Game-in-Flash-AS3-Tutorial

Enjoy!

Monday, May 23, 2011

Swivvel

Time for a new game release.

This game is called Swivvel and it's a match-3 style game with a twist - literally.

Press space to rotate puzzle pieces and score when you match three of the same color. It gets faster as you level up.


Click here to play Swivvel

Saturday, April 16, 2011

What Makes Final Fantasy XIII a Great Game?

I've just finished Final Fantasy 13 - the first FF I've played - and I want to share some thoughts on the game.

What makes Final Fantasy a great game?

1 Lightning

I just love Lightning's character. She's tough and she's cool, like a female Clint Eastwood. Sometimes morally ambiguous ("a target's a target"), she does soften somewhat throughout the game. A soldier by profession, a loner by nature, Lightning turns her back on the army to go on a one-woman suicide mission to save her sister. Somewhat reluctantly, she picks up an entourage along the way.

Game designers, please give us more characters like Lightning.

Lightning
2 Anarchistic Themes

Like many Japanese games, the storyline is hard to follow at times and too confusing to summarize here. The underlying theme, though, is clear: The Government lies to the people and abuses them; most people swallow the lies, but a few enlightened anti-authority types refuse to toe the line. Another theme is the Government's use of an invented 'enemy' to control the masses through fear, as espoused by Neo-con favorite Leo Strauss (http://en.wikipedia.org/wiki/Leo_Strauss).

Just take a look at our fine anarchist heroes:

"No rules, authority or obligations"

3 Value

I put 70 hours in to beat the game. While many Western games are this long, it is unusual to find a Western game with this quality graphics and artwork of that length (the game takes 3 discs on the 360). Western-made games with the best quality graphics are often less than 10 hours to play through. How the Japanese manage it, I don't know.

Have a look at this eye-candy:

"I made a promise and I'll see it through"


That's a wrap, folks, and that's why Final Fantasy 13 is a great game. Buy it!

Friday, April 1, 2011

Chobo: Trapped in a Tetris Game

So I had this premise for a game where the character is trapped inside a round of Tetris, and I made this into a Flash game.

Okay, well the game is similar to Tetris. I had to play around with the mechanics to get it to work nicely and I threw in a few enemies and power-ups.

I invite you to play the result:

Click here to play Chobo