Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: "MWForum" <mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Maze and keys
From: "Mike Sandy" <mjsandy@xxxxxxxxxxxxxx>
Date: Sun, 9 Oct 2005 14:25:42 +0100

You want two operations to run in parallel:
movement of the turtle and constant monitoring of the keyboard to change the heading.
Make the testing of keys a separate procedure e.g.


to change.heading
make "key ascii readchar
if :key = 38[seth 0]
if :key = 37[seth 270]
if :key = 39[seth 90 ]
if :key = 40[seth 180]
end

Then START can become:
to start
forever[change.heading]
forever[main]
end

Since the turtles in the 2 pages have the same colour and starting position
make that part of START, but since the turtles
are returned to the starting posn when various
things happen make start posn a separate proc.
to start.pos
seth 90
setpos [0 -145]
end


to start
setc 45 start.pos
forever[change.heading]
forever[main]
end

Testing for the turtle hitting a wall (different colours
for each page) can be done with
if member? colorunder [105 65] [maze, showtext wait 20 hidetext
start.pos]
;if the colorunder is either 105 or 65 show text ;return to the start posn.


There needs to be a text box "maze on each page - just copy the one on page1 and paste.

The START button on each page should only have DO IT "once" checked.

The alternative approach is to give the separate turtles
individual procedures via the backpack. Mike




----- Original Message ----- From: "Burke, Bridget -CKJH" <BRIDGETBU@xxxxxxxxxxxxxxx>
To: <mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, October 07, 2005 10:52 PM
Subject: Maze and keys



I am having a difficult time getting this maze to work with the keys.
The arrow keys work but the turtle just moves one space. How can I get
the turtle to move continuously and have the arrows keys setheading at
the same time?
I know there is a way but my limited knowledge of structuring a program
is killing this program.


Attachment: pp_new.mwx
Description: Binary data


  • Previous by thread: Re: Maze and keys
  • Next by thread: RE: Maze and keys

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008