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@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, Andrea Duran <aduran@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: MIA, Ask an Expert: pacman
From: "Daniel Ajoy" <dajoy@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Aug 2005 10:40:23 -0500

On 28 Aug 2005 at 23:03, Ask an Expert - Question wrote:

> This is an automatic message sent from the web form at:
> http://mia.openworldlearning.org/howdoi.htm
> 
> from: Andrea Duran <aduran@xxxxxxxxxxxxxxxxxxxxx>
> date: Fri Aug 26 16:51:43 2005
> 
> I'm attempting to make my own pacman game.  I figured the 
> only way I could program the turtle to eat the black lines 
> I drew was to use colorunder.  It works just fine but is 
> there a way I can program the game to know when there is no 
> more black on the screen and move on to the next level 
> (next page).
> 

Hi Andrea,

This is the only way I managed to make it work.

You need to know were you put your cookies.

Once you press the place.cookies button you need to
use the Paint Can tool to "eat" them manually (filling
them with white) you can do that in any order. You can
also use your own packman procedures to eat them if
you want. But once their are all gone you will get 
the announcement.

The waituntil line will check continuously of all
the cookies have been eaten. The check.all.eaten
procedure outputs "some.still.there" if there is
at least one cookie left, otherwise it outputs 
"none.left".

The code is below.

Daniel



to place.cookies
cg
make "positions [[-60 -60] [-60 -20] [-60 20] [-60 60] [-20 -60] [-20 -20] 
[-20 20] [-20 
60] [20 -60] [20 -20] [20 20] [20 60] [60 -60] [60 -20] [60 20] [60 60]]

t1, setsh "cookie
dolist [cookie.pos :positions] [setpos :cookie.pos stamp]
setpos [-100 100] setsh "packman

tester.turtle, ht
waituntil ["none.left = check.all.eaten]

announce [next level]
end

to check.all.eaten
tester.turtle,
dolist [cookie.pos :positions] [
 setpos :cookie.pos
 if colorunder = 9 [op "some.still.there ]
]
op "none.left
end







*****************************
OpenWorld Learning
http://www.openworldlearning.org

Attachment: CheckCookies.mw2
Description: Binary data


  • Previous by thread: MIA, Ask an Expert: pacman
  • Next by thread: Re: MIA, Ask an Expert: pacman

  • 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