View Single Post
Creating a Boolean function to turn on and off a light bulb.
Posts: n/a
Exclamation Creating a Boolean function to turn on and off a light bulb. - 09-28-2008, 06:15 PM

I already posted this question but nobody has answered and I really need help, so I figured I'd try again with a different name.

Here is my lab:

"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, the emissive color is black. Write a Boolean function isLightOn that returns true if he light bulb is on and false if it is off. When clicked, the lightbulb should turn on/off."

Here is what I have done so far:
1. Put the lightbulb into a room setting.
2. Wrote a method turnOnOff that looks like this:
lightbulb: set color to: black
lightbulb: set color to: yellow
3. Created a new event saying:
When mouse is clicked on 'lightbulb', do "lightbulb.turnOnOff"
(I do not know if step #3 was necessary it just seemed like something to do)
4. I started a new function calling it isLightOn. I pressed "Boolean" and now I'm completely stuck!

I need help getting the boolean function to work properly, and I need to know if I am supposed to put the event that I put in.

Thank you! Any help is appreciated! It is due Sunday night. I have a textbook but it really doesn't help me very much.
Reply With Quote