Time for action – using mouse location to hide arrows
This exercise will add a little bit of glitz to our project, but there's also a functional reason behind our wanting to build this interface. The arrows obstruct a part of our backdrop. Hiding the arrows shows more of the backdrop.
To determine when we show or hide the arrows, we need to continually check the position of the mouse. Let's start building the script to do this on the Next arrow sprite. Start the script with the when flag clicked block. Attach a forever block.
Inside the forever block, add the if () then, else block from the Control palette.
The if () then, else block checks to see if a condition is true. To determine when to show the arrows, we're going to check the x and y position of the mouse. We'll start by adding the () and () block from the Operators palette to the value of if () then, else to accommodate a check for both x and y positions.
In the left value of the () and () block, add the is greater than (>) block...