Hi guys
I am making a game where all the levels are quite short and different.
I am setting up my levels objects this way ...
self.monster1 = ...
self.monster2 = ... |
etc.
... to insure that they get removed when the scene is changed.
The question I have is about variables.
I've been setting up my variables by using ...
but I'm wondering if I should be using the same approach as before ...
Could anyone help me understand which is better?
Thank you in advance!
Comments
self.myVar = something
So it depends on how long you need your value to live
Likes: antix, Ninjadoodle
Thank you for the explanation
So, if Im setting up some variables inside the scenes init function ...
Thank you again!
Personally I think that's the best way, but somebody might have a better one.
Likes: Ninjadoodle
local myVar1
Here is more info on garbage collection with real example including global variable
http://www.giderosmobile.com/forum/discussion/comment/9441#Comment_9441
Thank you again for the explanation and links, it really helps clarify things