Moving Laptop
When Avery is walking, the laptop isn’t moving with the background, which makes it look like it’s floating along in front of her! In this step, we’ll make the laptop move with the background, so that Avery can walk up to it.
The aim of the game is to turn off all the appliances as quickly as possible. When the game starts your laptop should be turned on.
Click on the laptop sprite, and add the following code.
The laptop needs to stay still relative to the background, which means it needs to move relative to Avery.
Add this code.
Test your program. The laptop should stay still as Avery walks towards it. What happens when it goes off screen? It gets dragged along the left side of the screen!
We need to add code that will hide the laptop when it should be off screen. To do this, we will hide the laptop when it’s touching the edge.
Add this code.
Test your code again. The laptop should now disappear when it reaches the edge of the screen.