Home Power Hero

More Appliances

So far, we’ve only added code to our laptop, but we’ve also got a lamp and a TV, so let’s make those work, too.

  • The code for our Lamp will be very similar to our Laptop. Instead of writing all the code, let’s copy our three code stacks across.
  • We can do this by clicking and dragging each stack of code from our laptop sprite to our lamp sprite.
  • Once the three stacks are copied across, we’ll need to edit a couple of values.
  • Make sure you have the lamp sprite selected.
  • Update the location of the lamp, so it’s not starting on top of the laptop.
  • We also want to change the power usage for the lamp.
  • Change the power usage of the lamp to 0.028 (the number of Watt Hours used per second by a 100W incandescent lamp).
  • Test your program. You should now have both the laptop and the lamp in your game.