Halloween Game (part 2)

In class today we continued working on our Halloween games, with the intention of turning them into platformers. Chris did provide us with the basic code and game project that we would need for the platformer mechanics; we would plug in the assets we created last week to continue making the game.

First, however, we were presented with a problem: the left and right keys were inverted in the code and we had to figure out how to correct them. The code itself is interesting to learn, since it includes things I actually recognise some of it from doing the Flappy Bird tutorial – such as the use of gravity – and the code for  the controls were down at the end of the script.

stage.addEventListener(KeyboardEvent.KEY_DOWN, downKey);
stage.addEventListener(KeyboardEvent.KEY_UP, upKey);
function downKey(e: KeyboardEvent): void {

if (e.keyCode == Keyboard.RIGHT) {
isRight = true;
}

if (e.keyCode == Keyboard.LEFT) {
isLeft = true;
}

if (e.keyCode == Keyboard.UP) {
isUp = true;
}

}

function upKey(e: KeyboardEvent): void {

if (e.keyCode == Keyboard.RIGHT) {
isRight = false;
}

if (e.keyCode == Keyboard.LEFT) {
isLeft = false;
}

if (e.keyCode == Keyboard.UP) {
isUp = false;
}

}

I read the code as such: if the player is pressing down the up/right/left key, then the player character will move up/left/right. Once the key is no longer pressed, the player character stops moving in that direction. There are many other parts of the script in this game, so it will be interesting to see how this small piece of code works in with the rest of the script as we continue to learn more.

basic-platformer

 

 

To the left, this is the very basic game we were given to show the game’s mechanics and script we would continue to look at throughout the class.

 

 

 

The overall task of updating the basic platformer into our Halloween game was very straightforward. Anything we wanted the character to be blocked by should be put in the ground layer. Everything else could be transposed onto the canvas from our old file. I think the challenge here was not everyone will have created a scene that is appropriate for a platformer level. I have details and roof ledges, but I think I would have had more had I planned ahead a bit better.

Our stick-figure man could move across the screen, (hopefully) not fall through the ground if everything was placed correctly, and could even jump on the roofs/objects in our ground layer. He wasn’t really in theme with the game, though, so Chris asked us to design someone new for the player character. I decided to look online for ideas and ended up throwing the shapes down to make a little grim reaper-like player. I quite like him considering I’m still learning how to draw well in Flash. I think he matches the rest of the graphics we’ve been using for the game!

In the end, I think the whole project is coming together quite well. It may be a while before we get to build on them more, so I would like to do a bit more independent learning to see if I can familiarise myself with ActionScript and how a Flash platformer game is developed.

http://www.fastswf.com/TF3jN38

reskinned-platformer

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s