Alice Community  

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

Reply
 
Thread Tools Display Modes
Having some issues
Old
boisestbronco
Guest
 
Status:
Posts: n/a
Default Having some issues - 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?
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 02-28-2008, 01:50 PM

Quote:
Originally Posted by boisestbronco View Post
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

Last edited by DickBaldwin; 02-28-2008 at 01:51 PM. Reason: grammar correction
   
Reply With Quote
Old
gabe
Administrator
 
gabe's Avatar
 
Status: Offline
Posts: 461
Join Date: Jul 2005
Location: Pittsburgh, PA
Default 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.
   
Reply With Quote
Old
4RM0
Guest
 
Status:
Posts: n/a
Default 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;
Code:
[obj]whichSphere , [color]whichColor
were the parameters, and
Code:
[color]snowmanColor , [color]sphereColor
were the variables.

The method itself looked like this:

Code:
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:

Code:
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.
Attached Files
File Type: a2w Snowman Color Changing.a2w (211.0 KB, 344 views)
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
Default 03-25-2011, 10:53 PM

Just so you know, you can change the color of the snowman within its properties, and you don't need to ues spotlights.

The spotlight method works too, but I prefer using the model properties.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 03-26-2011, 03:58 AM

You're a bit late in replying.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 03-26-2011, 01:58 PM

Quote:
Originally Posted by David B View Post
Just so you know, you can change the color of the snowman within its properties, and you don't need to ues spotlights.

The spotlight method works too, but I prefer using the model properties.
You should really consider the date of the last post before posting. Some forum people find it irritating.


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
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 ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.