As we revealed in the last blog, the idea for the game is basically to stop a dam bursting by keeping a giant cork in the hole. This cork blocking can be applied to many things in life which is the main reason we chose this as the winner. We like cork.
Currently the game screen layout is in the form of a very shoddy sketch in order to give 3D Phil an idea of where things will be. This is how it looks:
As you can see, that's a pretty wide image. This means we're going to need scrolling and you know we are going to get fancy on that. Over to 3D Phil to explain the code bits for the movement so far:
To start with I need to make the boy move left and right in the game area.
The Boy movieclip will move horizontally on the screen while the background movieclip moves in the opposite direction underneath him.
I will trigger a movement function from the keyboard events and pass a direction parameter: -1 for left and 1 for right.
The horizontal (x) position will increase when moving right and decrease when moving left.
mcx.boy_mc._x += (gamevars.boyspeed/2)*dir;
//level 1 background
mcx.bg_mc._x -= (gamevars.boyspeed*2)*dir;
mcx.rocks_mc._x -= (gamevars.boyspeed*2)*dir;
I will try to explain this.
is a game setting where I am storing a number that controls how much the boy moves each time. This is currently set to 3 pixels.
is a reference to the horizontal position of the boy clip.
this adds a number to the current value.
this equation takes half the value of boyspeed and makes it positive or negative by multiplying it by the dir(direction) parameter which is either -1 or 1
The background layers are moved in the opposite direction by using -= this subtracts a number from the current value.
This function will eventually have extra code to stop movement at the left and right limits of the game area.
Also we will include parallax scrolling, this is where we have more than one background layer that move at different speeds to create the impression of depth and perspective.
Steeds will be beheld. Verily.
The long lost episode of Weebl and Bob that, thanks to recent...
It's Summer in the USSR and the Russian Dancing Men are out on...
Once upon a perfect peril...
So here it is! I'm starting Uni this September, and as...
A young boy faces the horrors of crack use through the smooth...
Is Zoella a good role model? I dunno. Good business model. I'd prefer my daughter to have a little more fire like @emmablackery.2014-10-22