Session 3 - Wednesday 14 February 2007

Well it was Valentine's Day today, so the pupils must love coming to this club because we had a full house for this session. Last week we created a spaceship which could be moved with the arrow keys on the keyboard, a vertically scrolling starfield, some falling asteroids and we also kept a score of how many falling asteroids were avoided.

In this session we decided to create a new side scrolling space shoot-em-up game with a mother spaceship and laser cannon and several enemy spaceships. The game will also have a side scrolling landscape and starfield, with a score being kept for each enemy shot down.

As graphics take quite a long time to draw, we started this session by importing some graphics from the internet to use in our game. We chose a spaceship, laser beams and an enemy spaceship and these were loaded into our Flash library as bitmaps. We changed the colour of the stage to black and then dragged the mother spaceship from the library on to the stage. As it was a bit large, we scaled it down in size. Then we made it a movie clip symbol and added some actionscript to move it around with the arrow keys, much the same as in the previous game.

Next we added a new layer for the laser beams and dragged the laser beam bitmap onto the stage. Again, we made it a symbol and then added some actionscript to duplicate it (for lots of laser beams) and fire it across the screen whenever the keyboard CRTL key was pressed.

There were lots of mistakes in the actionscript when the game was tested, so much of the evening was spent debugging the code. One things the pupils have learnt is that you have to be very accurate when typing code in - any mistakes in punctuation (syntax), spelling or capital letters cause errors in the program, and then it doesn't run correctly. Not surprisingly the pupils are getting very good at spotting errors too!

By the end of the session we had the beginnings of a very nice looking game with a keyboard controlled spaceship and a laser cannon firing laser beams across the screen. Here's a screenshot of what we did:

Next week we'll be adding a side-scrolling landscape and a second scrolling starfield giving a 'parallax' effect which gives the game the appearance of depth.

Come back soon to see what happened!

Mr. J.

No comments: