So what is the point of these variables, and what are we putting in them? You can create a variable in the 'Data' blocks section of the scripts tab. A variable is sort of like a box - you can store things in it, and look to see what's in it at different times. A variable is a way of storing data used in a the project. Let's go through it and explain how it works.įirst, we're using two variables - here named 'OldX' and 'OldY'. This is the entirety of the script that takes care of it:
The way that I do this is through the use of what I call the 'old X and old Y' method.Įssentially, you constantly record the current location of the sprite, and then go back to that when touching the lines.