Variables
-
Found out a bit more about ruby variables; turns out you can set variables properly without setVar or getVar:
@varThat's it! To set, use:
@var=1You can't use it properly with onTouch, but once onUnTouch comes that won't be a problem either. The thing is, it's not working how it's supposed to; it's acting like a global variable. It should be specific to a certain object... technically, $var is a global variable, but it appears to work the same.
-
Is that code there setVar or getVar subsitute

-
It's just the ruby script way. I guess the @/@@/$ bit saves it, so it works between frames, unlike normal ruby variables
-
That will work. But you should be aware of a few things:
Some variables names could cause things to break. For example @frame is already being used and if you override it could break things.
If you use something like "@foo" the value will be the same for all objects. Same as getVar and setVar are now. But in a future version each object will have its own version of "@foo". So keep in mind that a model that uses "@foo" now will change behavior when that version comes out.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement