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
Subject: Re: asteroid Game
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Thu, 05 Jun 2008 13:12:43 -0500
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;

On Thu, 05 Jun 2008 07:07:16 -0500, Dawn Young <youngd@xxxxxxxxxxxxxxxxxxxxx> 
wrote:

> That's what we can't figure out. The procedure talks to "bullet". Bullet
> is the turtle that gets launched when you hit the spacebar. What we
> can't figure out is how does bullet appear in the first place?  There
> doesn't seem to be any procedure that defines an action for spacebar so
> we can't figure out the logic to make it work for my student's game.
>
> We will also try your suggestion...work in progress as always...
> Thanks!

Hi,

I programmed this demo.

> how does bullet appear in the first place?

The turtle exists, but it is hidden, you can see it in the Project Tab.

It appears when the "shoot" procedure is called. I'll explain the first few 
instructions:

bullet,
setpos ask "t1 "pos
seth ask "t1 "heading
st clickon


bullet,
put yourself in the position of t1
set your heading in the heading of t1
SHOWTURTLE yourself, then activate

the bullet turtle then runs its instruction list:

repeat 200 [fd 1] cancel [touching? "bullet "t2] ht


That means:

move forward 200 turtle-steps, turtle-step by turtle-step
after than, cancel the process that tries to detect the contact of the bullet 
and the target
then HIDETURTLE



> There doesn't seem to be any procedure that defines an action for spacebar

Yes there is:

to startup
t2, clickon

forever [
if "| | = readchar [shoot]
]
end


it says:

t2, you are the target, start moving in a horizontal path.
then
if the key pressed by the player is the space character, shoot.


Daniel
OpenWorld Learning





  • Previous by thread: RE: asteroid Game
  • Next by thread: RE: asteroid Game

  • 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