Sunday, November 27, 2011

Dabbling in HTML5

Although I love Flash, I decided to dabble in HTML5 to see how easy or difficult it is to produce games in it.

I dug up this tutorial, which is excellent, and produces a 'BreakOut' game using HTML5, the coding in javascript, of course:

http://www.canvasdemos.com/2009/02/21/breakout/

The end product of the tutorial is a simple playable game. However, you have to jump through a lot of hoops to get there. This means that HTML5 for this kind of game is fine for the end user, but harsh on the programmer.

It also seems that HTML5 could be applied to simple games, like this one, but it would be a real pain to program a more advanced game in it. This is where Flash shines.

Flash, of course, is not available in-browser on the iPad, whereas HTML5 is. Android supports HTML5 too.

So I'm going to experiment and convert Drench (flashbynight.com/drench) to an HTML5 game and see how it goes.

I don't like HTML5 at the moment, and I'm experimenting with it grudgingly... but people say it will improve over time.

Sunday, November 20, 2011

Game Release: Retris 2

Time for another game release... introducing 'Retris 2'

Like the original Retris game (flashbynight.com/retris), Retris 2 takes the concept of Tetris and expands on it by featuring new types of blocks and bonuses. Retris is popular, but I wrote it when my programming skills were not so honed and I've always wanted to make improvements to it - I thought it would be good to make a sequel.

Retris 2 can be played at: http://flashbynight.com/retris2

Retris has 8 new block types:

1 The 'awkward' blocks - unusually and tricky shaped blocks
2 The 'eraser' block which destroys blocks of a similar colour
3 The back-and-forth block, which moves back and forth along the top of the screen until you press the down arrow.
4 The 'singles'  a column of single blocks that drop one after the other
5 Horizontal single blocks
6 The 'uber-line' - a full line of blocks that fall together
7 The 'lightning block' - a block that falls rapidly then slows
8 The superbonus - if you destroy this block in a line, you destroy ALL blocks beneath it and earn 1000 points. A lifeline, when you get into trouble.

In addition to this, blocks grouped in a rectangle of six of the same colour, will be destroyed.

Retris 2 will be in 'Beta Testing' mode until the end of November. This means that I may still be making changes to the game during this time. I'll also be taking suggestions for improvements. Post them here if you have any.

Here are some screenshots:





Thursday, November 10, 2011

A Couple of Good Android Apps

I would like to share a couple of great Android apps that I found recently.

1 Apps2SD (https://market.android.com/details?id=com.a0soft.gphone.app2sd&hl=en)

Apps2SD moves apps off your phone's internal memory and onto the SD card, thus freeing up tons of space. Once installed, the next time you download an app, it will give you the choice to install it on the phone or on the SD card

2 Out of Milk (http://www.outofmilkapp.com/)

I searched long and hard for a really good 'to do' list app. This great little app triples as a to-do list, shopping list and pantry list. This is the nicest one I found and it's great for trips to the supermarket.

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!