12-28-2018, 06:36 AM
(This post was last modified: 12-28-2018, 06:40 AM by DerVVulfman.)
Ooooh. Gotta make a note here. Thankies, Kyo.
Within the "Scene_PetConvention" class, we get to see both @instance and local values, the siletrea value, the @puma value and the dervvulfman value. But they're not just values. kyonides made OBJECTS!!!!
An object is a value that acts as a usable copy of another class, assuming data is within.
Remember what I said. Local values are even CHEAPER than @instance values.... they only work within the method whereas the @instance values can work throughout the class.
And here, the siletrea local value is really the siletrea local OBJECT... only usable within the method it's created. And again, it's an object... assuming the structure of the 'Person' class (the 2nd class in his example). The Person class has three values: Name, Age and an array of pets. So when he made a siletrea object, he had to fill in the values for the object. He could have put in more methods that could be run... but ... later.
Slowly study this.
OH, and remember how I said in the post ...
This creation of an object is how we make those $game_system and $game_temp objects. So in my previous example where I suggested reading data from $game_siletrea.... we do need to make an object first.
Yes, that means you can make $global objects too!!!
But just glance through this, and again.... Talk about the classes, super class, parent, child. I know you want to take things slowly. Not to jump into things too fast. We'll get back to this eventually.
Within the "Scene_PetConvention" class, we get to see both @instance and local values, the siletrea value, the @puma value and the dervvulfman value. But they're not just values. kyonides made OBJECTS!!!!
An object is a value that acts as a usable copy of another class, assuming data is within.
Code:
siletrea = Person.new
siletrea.name = "Siletrea"
siletrea.age = 22 # Guessing here...
Remember what I said. Local values are even CHEAPER than @instance values.... they only work within the method whereas the @instance values can work throughout the class.
And here, the siletrea local value is really the siletrea local OBJECT... only usable within the method it's created. And again, it's an object... assuming the structure of the 'Person' class (the 2nd class in his example). The Person class has three values: Name, Age and an array of pets. So when he made a siletrea object, he had to fill in the values for the object. He could have put in more methods that could be run... but ... later.
Slowly study this.
OH, and remember how I said in the post ...
Quote:There's a bit more too it than just this. We need to do stuff that lets that whole '$game_siletrea' thingie to work. But once we do, this is how you can make @instance variables from one class work within other classes.
This creation of an object is how we make those $game_system and $game_temp objects. So in my previous example where I suggested reading data from $game_siletrea.... we do need to make an object first.
Yes, that means you can make $global objects too!!!
But just glance through this, and again.... Talk about the classes, super class, parent, child. I know you want to take things slowly. Not to jump into things too fast. We'll get back to this eventually.