Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
lightbulb on/off
Old
essjai
Junior Member
 
Status: Offline
Posts: 1
Join Date: Nov 2011
Default lightbulb on/off - 11-16-2011, 10:48 AM

"Create a world with a lightbulb (Lights) and a method turnOnOff that turns the lightbulb on/off depending on whether it is already on/off. When the lightbulb is on, its emissive color property has a value of yellow. When the lightbulb is off, it's emissive color is black. Write a Boolean function isLightOn that returns true if the light bulb is on and false if it is off. When clicked, the lightbulb should turn on/off."

Okay I know this probably sounds like a stupid question because it's such an easy task but I'm completely stuck.

I made a new event for when the mouse clicks the lightbulb.
I also created a new method turnOnOff and I made the Boolean function isLightOn. It works fine.
But I don't know what to do now. Am I supposed to put the function into the method I made, if so how do i do this? If not, what am I supposed to do?
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Cool 11-17-2011, 02:25 PM

I'm not sure if I understand correctly interim what it sounds like, just create an if/else. Say if lightbulb is on turn off. Else turn on. Then drag it into the "if mouse is clicked on"
   
Reply With Quote
Old
GameKid
Senior Member
 
GameKid's Avatar
 
Status: Offline
Posts: 467
Join Date: May 2011
Location: My magnificent castle
Default 11-17-2011, 03:48 PM

Make two methods and use your boolean in the event.


[COLOR=e4eaf2]Your text here[/COLOR]
Come on, you know you want to try it.
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.