Task: Create a circuit breaker for the lamp of the previous lesson

In this lesson we will learn to create a switch which will control the function of the lamp.

First build the new lamp in a specific area of the house.

In the CONTENT tab we will create a new SCRIPT and copy the SCRIPT for the lamp
Then, save the changes by the SAVE button.

 

To receive and copy the code, click on the code link for the lamp.

 

Now build the button that will control the lamp. Build a cube and place it on the wall and change the name of the object to Button

(as shown earlier, in the code we defined that the object that will activate the lamp is called Button)

We will now create the code  SCRIPT for itself.

Copy the code for the circuit breaker and paste it on a new SCRIPT you created for it.

Save the changes by clicking the SAVE button

 

You can turn on the lamp by pressing the switch.