Imagine Logo

A Hungry Turtle

Build the project | Design the project | Programming | Run project... | Save as web project | Browse project | Tell your friends about this project


  • to define another events, to work with two turtles, to write a project as a web page, to use a new command overlapped
You need to know
  • basic commands of the turtle geometry, to add and work with the buttons, to add and work with the texts
You will learn
  • how to create a project that is accessible to everyone by means of a browser, e.g. Internet Explorer or Netscape

Build the project

Here you will create a simple project with instructions. The project is very simple: the turtle is looking for something to eat and not far from it is some lettuce. The player's task is to move the turtle to this lettuce. If the player clicks the left mouse button on the turtle, it will move 30 steps.
If he clicks the right mouse button on the turtle, it will turn by 45 degrees.

If the turtle finds the lettuce, the notice YUM will appear nearby. There is also the button New game on the page that replaces both the turtle and the lettuce. In addition the project contains the text with the player's instructions...

Designing the project

  1. The turtle looks for its food and moves by clicking on its shape. You will need to define its onClick event (or the event onLeftDown – Note: a click means pressing and releasing the left mouse button and the event onLeftDown means only pressing the left mouse button. Therefore the event onLeftDown is performed earlier than the event onClick. Furthermore, you will need to define its event onRightDown which allows the turtle to turn.
  2. The lettuce will also be a turtle with the lettuce shape. You can draw this image using the painting tools, or click here to download a ready-made graphic.
  3. The notice YUM will be the hidden text which appears only when the turtle finds the lettuce.
  4. For the button New game you will need to define the event onPush, which will move both turtles to a random location on the screen and hide the text YUM.
  5. Finally you will write the instructions for the player.


Start a new Imagine Logo project.

Click with the right mouse button on the turtle t1, and select Change t1. On the first tab add a tick for Pen down and select the Events tab. Select the Add button and in the next dialog select the event onLeftDown, and press OK. In the onLeftDown event's line type the command fd 30 and click OK. Try out the turtle on the page: it moves forward.

You will program the event onRightDown later – first you will add a second turtle (the lettuce) and the text for the notice YUM.

Select the New Turtle button and add a new turtle to the page. Select Change t2 in its context menu and the button Set Shape in the dialog. The Choose an Image dialog will open and here you can find the image of a lettuce. – you could find another on the internet and save it to disk in advance. Alternatively, click here to download a ready-made graphic. Do not forget to turn off the turtle's drawing - unclick the setting Pen down.

Select the button New Text Box from the Main toolbar and put a text box on the page. Write the word YUM inside. You can change its font and colour as required. Click the right mouse button on the text, select Change text1 and add a tick for Transparent Background in the dialog, then click on OK. Finish the text editing by pressing the close button  in the Font Setting dialog. The text is still visible, but do not worry, it will be hidden at the start of the game.


Select  the New Button tool from the Main toolbar and put this new button on the page. Select Change b1 in its context menu and type, for example, New game into Caption. In the event onPush, type commands to hide text1 and to put the turtles into a the random position:
text1'hideMe t1'setPos any t2'setPos any

Close the dialog by clicking on OK.


Now to add some instructions. Select the New Text Box button, and place it anywhere on the page. Here you can type in the project's description, for example:

There is a hungry turtle on the meadow. Help it to find the lettuce.
To move the turtle, click on it with the left mouse button. To turn the turtle, click on it with the right mouse button.

Finally, return to the context menu of the turtle t1, select Change t1 and choose the Events tab.In the event onLeftDown add the commands to find out if the turtle finds the lettuce: use the basic command overlapped, that allows you to find out, if after moving forward, the turtle will find the lettuce, that means whether the lettuce covers the turtle t2. In case the lettuce covers the turtle, move text1 into its position and show it:
fd 30 if overlapped=[t2][text1'setPos pos text1'showMe]

Select the Add button and choose the event onRightDown.Here, type the turtle's turning angle - for example 45 degrees: rt 45.

Close the dialog by pressing the button OK.

Run project...

You can now test your project: click with the left mouse button on the turtle to move it, click with the right mouse button on the turtle to turn it. When the turtle moves to the lettuce, the text YUM will appear. If you press the button New game, the turtles will move to a new random position.

If the turtle is invisible when it finds the lettuce, or in the new position you cannot see both the turtle and the lettuce:
the objects on the page are presented in the order in which they will be viewed. If you change this order, you can see them in the order you want – into the command line type:
? reorder [text2 t2 t1 text1]

Save as a Web Project

From the File menu choose Save as Web Project. In the dialog that appears you can change Title, Text, select the folder (meanwhile stay in the folder Web, that is a subfolder of the install folder Imagine) and primarily do not forget to type the name of the file for example hungryTurtle

Browse project

Let's see what our project looks like on the web. Close Imagine Logo and run your web browser e.g. Internet Explorer. Select Open from the File menu. Select the Browse button and locate your new web project. By default, this will be

C:\\Program Files\Imagine\Projects\Web\

There you will find your saved HTM file A Hungry Turtle.HTM. Select Open and then the OK button. Your project will load; you can play with it here just as you would in Imagine Logo.

Tell your friends about this project

Ask your parents to display your project on the Internet, e.g. on the server with their URL address. Put 2 files there - in this case A Hungry Turtle.IMP and A Hungry Turtle.HTM. You parents can tell you their URL address, and then your friends can play your project too.

Let your friends know about your file (write or send an email). If they do not have a copy of Imagine Logo, they need to visit the page and install the Imagine plugin program. They will then be able to play all your Imagine Logo projects.

Download the Project

You can download an example of the finished project by clicking here.



SCHOOLS NorthEast Discount

Step by Step Activities


Simple Turtle

Framework Editor

Get the Plugin

Gallery of Work

Design & evaluation of Maths related programs for Special Education

Keyboard Shortcuts

Minimum Specification

Current software v.2.401a

"You really can't go wrong with Imagine. It is a thousand programs rolled into one..." Sue Broadbent, Waterloo & Moorside Primary Schools

"...any project that has been created can be saved as a stand-alone .exe file, or as a web page. Pupils are thus encouraged to think about audience during the authoring process..." Jackie Prouse, Bradley Barton Primary School

"This is a situation in which ICT has been used as a tool to express, but also to explore, the imagination of each individual pupil." Louise Siaw, Penwortham Primary School

"...a flexible program with excellent cross-curricular potential." David Wynn, Rushall JMI School

" well as using Imagine in ICT, children at Stockham School have used Imagine in a variety of other subject areas, including Art, Maths and Literacy." Stuart Taylor, Stockham School