Shark Attack

This guide has been designed to help you create a simple game. Follow these step-by-step instructions to create an interactive game complete with scoring system. Complete the extension tasks to increase the difficulty.

Stage 1 - Making the Background

Select the stage ...

... click on the "Backgrounds" tab then "import" ...

From the backgrounds choose "Nature" ...

... and then find the image called "underwater" Press "OK".

This is what you should see. You can delete the white background if you wish.

1. Screenshot your project so far and describe changing the background of your project.


Stage 2 - Adding the shark

Click back on the cat (its a "sprite", a graphic that can be given instructions). Change the cat into a shark by clicking on "Costumes" and then "Import" ...

... then from the "animals" folder ...

... choose "shark 1-a"

Press "OK" and the cat will become a shark.

You can now delete the cat costumes that are not needed.

Now add another costume to the shark, "shark 1-b".

Your shark will have two costumes and when the script switches between them the shark will be opening and closing its mouth.

2. Screenshot your project so far and describe changing the costume of a sprite.


Stage 3 - Writing the script for the shark

Now we need to give the shark its script, the instructions that will make it do things.

By the way, there is a little button highlighted in the picture below. Click this to make the shark only face left and right; this will stop the shark from flipping onto its back. Quite a few people have missed this step out, please don't be one of them.

Click on "Control" to see the list of control options and then drag the "When green flag clicked" instruction into the script area.

Now make this script.

When the green flag is clicked a "forever loop" will start.

Inside the loop are a series of instructions.

  • point towards the mouse pointer
  • move 10 steps

These two lines make the shark move towards to position of the mouse pointer 10 steps at a time.

  • next costume
  • wait 0.1 secs

These two lines make the shark change between the mouth open and mouth closed costumes every tenth of a second..

3. Screenshot your project so far and describe the script you have given the shark sprite.


Stage 4 - Adding fish for the shark to eat.

Add a new sprite from the folders.

Choose one of the fish.

Right click on the fish and resize it to make it smaller.

Now add this script for the fish.

This is a repeat until loop that makes the fish move 4 steps at a time. If the fish touches the shark it is hidden.

Change the settings so that the fish can only move from side to side and no longer swims on its back.

4. Screenshot your project so far and describe adding a new sprite.


Stage 5 - Counting the number of fish that the shark has eaten.

From the variables scripts choose "Make a variable"

Give the variable the name "Eaten".

It needs to be valid for all sprites.

Press "OK".

Now change the script for the fish so that every time it is eaten by the shark the number of fish eaten goes up by 1.

To make life more difficult for the player we need the fish to appear at a random spot and not in the same place every time. Use the "pick random" script. I have shown Y but you need to write X as well.

Notice that I have added the random value for x here.

Now make the fish reappear 2 seconds after it has been eaten by putting the completed script inside a forever loop (to make it repeat) and add a wait of 2 seconds at the end.

Right click on the sprite and select "duplicate" to make more fish. You may wish to make the different sizes.

5. Screenshot your project so far and describe making a sprite appear at random.


Stage 6 - Adding the octopus

To make the game more difficult add an octopus that will set the score to 0 if the shark eats it by mistake. The octopus has two costumes to import.

Here is the script for the octopus.

Now you can play the game.

Stage 7 - Making the game more difficult

You can make it more difficult by adding a different fish that travels vertically, scores 10 and can only appear once.

How might you get the game to decide when the player has won, say by eating 20 fish?

You can add another fish that makes a prey fish vanish so the shark has less to eat.

How might you set a time limit on the game?

Use project 2 to make the shark change colour as it moves about.

6. Screenshot your project so far and describe including one of the changes listed above.


Don't forget to save your project as "Shark Attack" when it is complete.

Year 8 Additional extension work.

To make the game more difficult, you could make the shark smaller over time, you could make the octopus re spawn and move more quickly each time. You could make the fish move at different speeds or change direction at random or disappear from time to time. You might even get the game to keep score as you eat more fish.

7. Screenshot your finished project so far and describe including at least one of the extensions listed above.


Recent Posts

May 24

Repairing a hyperspace window

You may have noticed the time shift in the Blue coridor, there is a redshift at certain times of the day; this has caused the bells to malfunction and the PCs are runing slow as the server room is also moving ever so slowly into the 5th dimension. The Lightspeed engineers are working hard to fix the hyperspace window being generated by the tidal effects of big data and the weaknesses in the walls caused by excessive data mining. Cambridge Analytica's data scraping has also contributred to the weakness in the space time continuum. There is no need to be afraid as everything is should be resolved in the near future; nevertheless steps are being taken, mostly from the gold staircase.

Any further information will be included here when and if we get it.

July 18

Adventuring with A GDPR SUrveyor

The GDPR surveyors will be in the College in the near future checking that you understand your obligations under GDPR. Are you aware of the consequences? Do you know who knows about you? Do you know what the people you don't know about, know about you? Have you checked your own settings? Are you privacy minded? The GDPR surveyors will check. They know you, possibly better than you do but maybe not as well as the Internet knows you.

July 14

Games for Free

There are a number of games that you can get for free that are really good. They are really good at collecting all of your data and passing it on to someone else. You don't know who they are and you don't know why they are collecting your data. They have your data and access to your friends. In minutes they have your friends' data and are collecting the data from their friends. If its a good game you will even tell your friends about it so you do their sneakiness for them and still tell your friends. It will never happen to you but hey that game...


Neural Implants

The pros and cons. Mostly cons.

Be permanently connected to Google and you can ask Alexa in your head; only you can hear the answer...