Alice Community

Alice Community (
-   Questions and Comments (
-   -   lightbulb on/off (

essjai 11-16-2011 10:48 AM

lightbulb on/off
"Create a world with a lightbulb (Lights) and a method [I]turnOnOff[/I] 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 [I]isLightOn[/I] that returns [I]true[/I] if the light bulb is on and [I]false[/I] 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 [I]turnOnOff[/I] and I made the Boolean function [I]isLightOn[/I]. 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?

dakota95 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"

GameKid 11-17-2011 03:48 PM

Make two methods and use your boolean in the event.

All times are GMT -5. The time now is 11:57 PM.

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