[Thread Prev] [Thread Next]
Hi Group,
I botched my response... Too rushed. This sample works great for me.
In fact, it is way cool.
Mike
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Daniel
Ajoy
Sent: Thursday, June 05, 2008 11:13 AM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: asteroid Game
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.
|