I will give you the code that I have copied (except in the beginning which I have altered.) I understand the beginning but find it difficult to understand inside the "function" method. I have added questions to the places I don't understand as a comment.
Please help me understand these. Also please help me understand what "apply/call" do.
JavaScript:
/*:
*@author Gene
*@plugindesc desc Testing 123
*@help helping testing
*@param paramTest
*@type text
*@default heyheyhey
*/
(function(){
var params = PluginManager.parameters("window_mine");
var text = params["paramTest"];
var lh = Window_Base.prototype.lineHeight() * 2;
function My_Window() {
this.initialize.apply(this, arguments); //What exactly does this do?
}
My_Window.prototype = Object.create(Window_Base.prototype);
My_Window.prototype.constructor = My_Window; //Why assign itself to the prototype constructor?
My_Window.prototype.initialize = function(){
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, lh); //where is the "initialize" function in the Window_Base class?
this.refresh();
}
My_Window.prototype.refresh = function () {
this.contents.clear();
this.drawText(text, 0, 0);
}
var smstart = Scene_Map.prototype.start;
Scene_Map.prototype.start = function () {
smstart.apply(this, arguments);
this.my_window = new My_Window(); //Why create this variable "my_window"?
this.addChild(this.my_window); //What does the "addChild" function do?
}
console.log(text);
})();
Please help me understand these. Also please help me understand what "apply/call" do.