Back

Modelling levels - 1

fastWhen you write computer games, you very often want to have different levels of difficulty. You might want players of your game to start at level 1. When they have successfully completed level 1, you want them to play a slightly harder version of the game at level 2. Each level they move on to is slightly harder than the previous one. The aim of this project is to model how this can be achieved. You can then use this technique in your own games, whether you are writing them in Python, Scratch or some other programming language.

We are going to keep this modelling project nice and simple. We will write a function that moves a dot from the left hand side of our screen to the right hand side. We will then present the player with a menu. They can choose from 'Easy', 'Medium' or 'Hard'. We will then load up the appropriate values for that level of difficulty into the function. The function will then set itself up as instructed and move the dot at the appropriate speed. 

For the Easy level, we will have a big blue dot that moves slowly across the screen. For the Medium level, we will have a smaller red dot that moves faster across the screen. Finally, the Hard level will be a tiny black dot that moves quickly across the screen. It doesn't take a lot of imagination to realise that the dot could be anything from a cat, a person, a missile or an alien spaceship.

Our first job as always is to write a plan. We need an algorithm.

Back