PDA

View Full Version : Having some issues


boisestbronco
02-28-2008, 01:35 PM
Playing around with this exercise:


Your team has created a snowman as the centerpiece of an entry in teh Winter Snow Festival competition. To attract attraction to your display, you have set up colored spotlights that will turn the color of the snowman any one of four different colors. Create an initial world with four spotlights (spheres from the Shapes folder, of four different colors) and a snowman. Write only one method to change the color of the snowman. When the user clicks on a spotlight pass the color of the spotlight to the method and make the snowman change to be that color.




I can't figure out how to do that in one method for the life of me. Any hints?

DickBaldwin
02-28-2008, 01:50 PM
Playing around with this exercise:


Your team has created a snowman as the centerpiece of an entry in teh Winter Snow Festival competition. To attract attraction to your display, you have set up colored spotlights that will turn the color of the snowman any one of four different colors. Create an initial world with four spotlights (spheres from the Shapes folder, of four different colors) and a snowman. Write only one method to change the color of the snowman. When the user clicks on a spotlight pass the color of the spotlight to the method and make the snowman change to be that color.

I can't figure out how to do that in one method for the life of me. Any hints?

Don't know if this will help or not, but I have published an online tutorial at http://www.dickbaldwin.com/alice/Alice0200.htm titled Understanding Lighting in Alice 2.0.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

gabe
02-28-2008, 03:01 PM
This is in the wrong forum. I am moving it and deleting your duplicate post, so all replies will be centralized.

4RM0
02-28-2008, 05:54 PM
See if this world attached is what you need. What I did was have one method with two variables and two parameters in the method; [obj]whichSphere , [color]whichColor were the parameters, and [color]snowmanColor , [color]sphereColor were the variables.

The method itself looked like this:

Do together(
[color]snowmanColor set value to [color]whichColor
[color]sphereColor set value to [color]whichColor)
Do together(
[obj]whichSphere set color to [color]sphereColor, duration = 0 seconds
snowman set color to [color]sphereColor, duration = 0 seconds)

As for events, I had a rather long (perhaps not-required) list:

When {mouse} is clicked on sphere, do world.my first method (whichSphere = sphere, whichColor = red)
When {mouse} is clicked on sphere, do world.my first method (whichSphere = sphere2, whichColor = none)
When {mouse} is clicked on sphere, do world.my first method (whichSphere = sphere3, whichColor = none)
When {mouse} is clicked on sphere, do world.my first method (whichSphere = sphere4, whichColor = none)
When {mouse} is clicked on sphere2, do world.my first method (whichSphere = sphere2, whichColor = green)
When {mouse} is clicked on sphere2, do world.my first method (whichSphere = sphere, whichColor = none)
When {mouse} is clicked on sphere2, do world.my first method (whichSphere = sphere3, whichColor = none)
When {mouse} is clicked on sphere2, do world.my first method (whichSphere = sphere4, whichColor = none)
When {mouse} is clicked on sphere3, do world.my first method (whichSphere = sphere3, whichColor = blue)
When {mouse} is clicked on sphere3, do world.my first method (whichSphere = sphere, whichColor = none)
When {mouse} is clicked on sphere3, do world.my first method (whichSphere = sphere2, whichColor = none)
When {mouse} is clicked on sphere3, do world.my first method (whichSphere = sphere4, whichColor = none)
When {mouse} is clicked on sphere4, do world.my first method (whichSphere = sphere4, whichColor = orange)
When {mouse} is clicked on sphere4, do world.my first method (whichSphere = sphere, whichColor = none)
When {mouse} is clicked on sphere4, do world.my first method (whichSphere = sphere2, whichColor = none)
When {mouse} is clicked on sphere4, do world.my first method (whichSphere = sphere3, whichColor = none)

Hope it helps to make yours, I wasn't going for efficiency when writing it.