Starlogo: Mario and Luigi Game

Part 1

Before you start:

  1. Create a folder in your ICT folder called ‘Games’

  2. Open Programming / Star Logo / NEW

  3. Save As ‘Mario’ in your Games folder

  4. Note the distinction between 'Factory' and 'My Blocks' in the top left corner: Factory is where the generic program blocks are kept; <y Blocks is where turtle-specific blocks and commands are kept.

Change the Turtle into a Mario:

  1. Click Edit Breeds

  2. Select the People menu

  3. Select Mario

  4. Rename the turtle as 'Mario'

Create a setup procedure:

The Create Mario and Scatter Mario blocks are in the

Create a movement procedure in a Forever block:

Complete the procedure so that Mario can move forward, back, left and right. How many degrees should Mario turn left or right? Large numbers will produce large jumps and the game will run fast; smaller steps will make the game run more smoothly and slowly.

The next steps
  1. Rename the procedure from 'Forever' to 'movement'

  2. Create a new breed called Luigi (select the Luigi character)

  3. In the setup procedure add a 'Scatter Luigi' (or remove 'Scatter Mario' and use Scatter All)

  4. Under the Luigi tab of the Movement procedure create instructions to control the movement of Luigi

Hint: You will have to use the ‘a’, ‘s’, ‘d’, and ‘e’ keys instead of ‘up’, ‘down’, ‘left’ and ‘right’.

Extensions

Easy: Alter the terrain to create a more interesting landscape

Medium: Change the speed and turning properties so each character is different

Hard: Make the characters jump (they must also fall after each jump)

Part 2

The aim this time is to create weapons for Mario and Luigi that are executed by new keys.

The statements to produce the balls is tacked onto the end of the existing code block:

Adding a Fire Button

Add a new if..test..then block after the keyboard right arrow if block. Test a new key press e.g. space: this will be the Fire button.

New Breed

The new if block will ‘hatch’ a new breed called ‘ball’ which is a simple sphere. Note that you can change the colour of simple shapes like the sphere. Accept the default green for now.

Hatch

When the new key is pressed the Hatch procedure will be triggered – this produces a new copy of the specified breed. Hatch is in the Logic section of the Factory.

In the Hatch do section you will need to move the character 2 steps forward and then breed a new ball. To do this you will need a Set Breed block and a Breed. The Set Breed block is under Traits while the required breed block is in My Blocks under the breed specified (ball). Finally add a set size block with a value appropriate to the game (experiment).

Luigi

Repeat the hatch code you have created for Luigi (if, key press, hatch, set breed, breed).

Finally, you will need to add a single instruction to the ball section of the Movement block. What does the ball do when released?

Extensions

Change the colour of the balls produced by Luigi so you can tell them apart from those of Mario.

Experiment with different sizes of ball.

Mario and Luigi Game Part 3

We now need to add routines to determine what happens when collisions take place between the three characters (Mario, Luigi, balls).

Three collisions are possible: Ball/Mario, Ball/Luigi, Mario/Luigi (we ignore ball/ball, though we could add something later).

The collision blocks can be found in My Blocks under each character.

Mario-Luigi

When Mario and Luigi collide you could make them retreat 10 steps and make a suitable sound. To do something 10 times use a Repeat block.

Ball-Mario and Ball-Luigi

When a ball collides with either character they should die.

Mario-Ball and Luigi-Ball

The collisions between Mario, Luigi and balls are simple: the characters die. The balls can die too.

Further Activities

Most of the balls don’t die, they just hang around and clutter up the playing area. Can you think of a way to make them go away?

Add new characters to interact with the existing objects in the game. How many players can you fit in?

Monitor the effectiveness of the ball killing routine by counting them. Add a line chart and set it to count the number of balls in the game.