![]() ![]() We need to store this so that we can use it to go back to that point, when we're touching the lines. Now what do we need to do with this data? Why are we storing it? So what these variables are doing are keeping note and storing where the sprite currently is, using the "x position" and "y position" blocks found in "Motion". Y is the vertical axis, and x is the horizontal axis. These variables are storing the x and y positions of the sprite - where it currently is on the stage. ![]() 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |