Hey all, I'm making a metroidvadian here and I figured, in order to teleport to a specific layout, I would use a sprite with a text instance variable "location". On contact, I planned to make the sprite teleport the player to wherever the instance variable is set to go to (e.g. "location" is set to "cave", therefore it will teleport the player to the layout named "cave"). However, it appears that the ampersand operator cannot be used for instance variables.
Is there some way I can use instance variables like so? If not, is there a workaround? Thanks!
What does ampersand have to do with setting the value to cave?
Unless perhaps the first part of the existing value is ca, and you are adding ve to that.
Hmm, I have no idea what you're talking about, so I think I may be misunderstanding what the ampersand command is actually used for. So to clarify, is there anyway that I can use an object's instance variable IN expressions?
EDIT: I'm new to this, so the jargon escapes me. How about a picture?
See, I want to use the instance variable's value (whatever it may be for the current object) there (or wherever).
Develop games in your browser. Powerful, performant & highly capable.
Sure just just reference the variable yourobject.variablename
You should do some more starter tuts if yours unsure about that part.
Its pretty basic, and will be used quite a lot.
Cool, thank you.