![]() |
Global variable help
I'm making a helicopter simulator, and need to change a variable with keys, and then move the helicopter that amount in the main method. I need a global variable to do this, but how?
|
...in Alice 3.1
|
I found how to make global variables, and how to move an object based on that variable, but I can't find a way to modify the variable during runtime.
Best I can do is make a temporary variable which serves as a modifier for the global variable. Will that do? |
...It would be nice to know how to make it, first ahaha
Edit: I need to know everything there is to know about global variables, the program is due in a few days and I can't do anything as of right now. |
To make a global variable:
-click the scene tab at the top of the screen -click the button that says "add scene property..." under the word "unmanaged" -select "decimal number" from the first dropdown menu, name your variable, then select anything from the second dropdown menu This is your global variable. Any method can reference it. To do so, make a method, such as "helicopter move". On creation of the method, two popup menus will appear. First will be direction of motion, and second will be distance to move. At the bottom of the second menu, your global variable will be listed as an option. |
It's relatively useless if you can't modify it... What's the point of it?
Edit: I FOUND IT! To modify it, go to the "properties" tab on the left side, next to Procedures and Functions tab. Drag in the variable from that tab (The one which says "this(var name) = ???"), and you can modify it. This just made my day. Edit 2: Not sure what version I'm running on, I'll update this post when I find out tomorrow, I guess they removed it in one of the newer versions of Alice. |
I looked there first. Didn't show up for me.
I wonder why. |
I'm running on v3.1.58
|
All times are GMT -5. The time now is 03:00 PM. |
Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.