Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Gatekeeper Help
Old
tHobbs
Guest
 
Status:
Posts: n/a
Default Gatekeeper Help - 10-13-2008, 10:02 AM

I am quite confused on the Gatekeeper Project (page 178, Learning To Program w/Alice book).

I cannot seem to think of a code to make two of the objects switch places, I can get one, but the getting the other is confusing.

Any suggestions?
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 10-13-2008, 05:24 PM

Quote:
Originally Posted by tHobbs View Post
I am quite confused on the Gatekeeper Project (page 178, Learning To Program w/Alice book).

I cannot seem to think of a code to make two of the objects switch places, I can get one, but the getting the other is confusing.

Any suggestions?
If you have two objects beside one another you probably need to determine which object was "clicked" first. Then you can use the function Object is to the left of (or right of). Then maybe use a Do Together and place statements like:
If object clicked is to the left of object NOT clicked
Do Together
Object1 move left Object1 Distance to Object2
Object2 move right Object2 Distance to Object1

otherwise the object clicked is on the right and you place the opposite code in your Else portion of the If statement.

I used the Do Together structure because this allows Alice to compute distances from each object before any of the objects move.

Good luck

Last edited by lanceA; 10-14-2008 at 08:20 PM. Reason: normal typos
   
Reply With Quote
Old
dan2343
Guest
 
Status:
Posts: n/a
Default 10-14-2008, 10:11 AM

Does anyone have a completed version of the gatekeeper?
   
Reply With Quote
Old
tHobbs
Guest
 
Status:
Posts: n/a
Default 10-14-2008, 06:05 PM

Quote:
Originally Posted by dan2343 View Post
Does anyone have a completed version of the gatekeeper?
why would you want a complicated one?
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 10-14-2008, 08:17 PM

Quote:
Originally Posted by dan2343 View Post
Does anyone have a completed version of the gatekeeper?
I do, but I am a teacher and unfortunatly can not give it to you? Does your teacher also come here to see if any of his/her students are looking for others to do their homework? Several teachers have introduced themselves to their students in this forum.

It's extremely hard to learn to program unless you first try to do it yourself.

To solve this problem use my previous post about moving Objects. The solution to the project is to have the Gatekeeper in position 4.

As you already know, you will need to write your own methods and Event Handlers.

If you stop and thank about it the code will not be that difficult to write. Visualize the problem that you need to solve for this project, draw it on paper if you need to. Logically visualize the steps you need to go through in order to solve this problem.

Good luck,

Last edited by lanceA; 10-14-2008 at 08:36 PM. Reason: bloody typos
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.