Alice Community  

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

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Need Assistance
Posts: n/a
Default Need Assistance - 04-11-2008, 07:07 PM

I'm currently working on project 1 in Chapter 6. I cannot even get past the first hurdle, and that's getting the objects to switch with one another.

Basically I've got to take four objects and line them in a row, 1 - 2 - 3 - 4. When the user click an object it switches with the object furthest from it. So when you click 4 it swaps with 1, 3 with 1, and 2 with 4. I haven't even the slightest clue of where to begin. I can write a method that makes 1 switch with 4, but only those two objects regardless of where they are in the line up.
I cannot for the life of me figure out how to assign objects numbers when they're in a specific position so that I can just make a method that calls Obj1 to move to Obj4 depending on what object are in those spots. Could anyone guide me in the direction as to how I can even begin this program?

I imagined that I could use nested If/Then statements, but I am flat out stumped. From 1 to 4 I've got Anubis, Isis, Ra, Pharaoh. I figured I would be able to do something like the following and just repeat it two more times for the other possibilities.

If Anubis distance to Pharaoh > Anubis distance to Isis AND Anubis distance to Ra
Then Do Together Anubis move distance to Pharaoh / Pharaoh move distance to Anubis
but I can't figure out how to make an a > b and c function.

Last edited by AcidicPlague; 04-11-2008 at 07:39 PM.
Reply With Quote

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 ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.