Monday 23 September 2013

Making a basic sniper game

First off we need to add our standard score borad which increse by 1 for every time you successfully hit a target.

Then we add a ammo variable which must be greater than zero in order for a hit to be registered.

Scratch code
Went the space key is pressed we've set it up so that the ammo count will replenish itself.

reload code

This is simply the shooting aspect of the game. A target for the player to aim and shoot at must be introduced. 
In this game a space ship was added as the target. Every time a successful hit was registered the ship would change its costume from

Spaceship sprite

To

Expolding spaceship sprite

This slight visual effect adds quite a bit to the game.
The ship is set to randomly deploy on the right of the screen and  then fly towards the other side of the screen where if it wasn't hit it will disappear and reappear in another random location on the right hand side

Scratch movement code

sensor is simpally another sprit which is put in place to be hit by the ship weather it was hit or not.
This is its code block.

Set loctaion code


No comments:

Post a Comment