- Joined
- Jun 21, 2015
- Messages
- 1,441
- Reaction score
- 680
- First Language
- Polish
- Primarily Uses
- Other
Hello everybody!
I would like to ask how to refer to a instance variable from another class.
So, let's say I have something like this:
Don't mind the messy examples and such, I just want to know how to refer to that variable in different class.
Why am I asking?
Because I'm modifying Galv's Invader Minigame and there's lots of local variables in minigame's part.
What I want is to put these variables in SCORE WINDOW located at the bottom - just to show these values via draw_text etc. and that's all.
How can I do this?
Thank you.
I would like to ask how to refer to a instance variable from another class.
So, let's say I have something like this:
class Warrior < Sorcerer # stuff here it totally random and that's not important def init_variables @turtle = 0 # so I have that variable here and the stuff is happening with this... end def smell_da_turtle something here IDK, for example if smell_da_turtle @turtle += 1 # here... else lol end endendclass Windows_XP < Window_Base # and we have different class here - #the window where I want to put that variable in. (initialize...) def refresh contents.clear draw_text(0, 0, 100, 24, @turtle) #I want to do something like this end (other stuff...)end
Why am I asking?
Because I'm modifying Galv's Invader Minigame and there's lots of local variables in minigame's part.
What I want is to put these variables in SCORE WINDOW located at the bottom - just to show these values via draw_text etc. and that's all.
How can I do this?
Thank you.
Last edited by a moderator:
