- Joined
- May 2, 2017
- Messages
- 4
- Reaction score
- 0
- First Language
- German
- Primarily Uses
- RMMV
Hi guys,
I'm new to Javaskript and I don't quite get the setHandler functions.
What I'm trying to do:
I created a new menu option called "worldtree".
It's supposed to open a window and display an image.
And when you press ESC you get back to the menu.
I used some tutorials to create the window and draw the image, BUT whenever I open the window, I'm stuck.
I can't get back to the menu.
If I got it right (?), I need a setHandler to do this. The thing is, everytime I add the setHandler to my code I get an ERROR (TypeError undefined is not a function).
So my question is, how do these setHandlers work and what do I have to do to close the window?
Thanks in Advance
I'm new to Javaskript and I don't quite get the setHandler functions.
What I'm trying to do:
I created a new menu option called "worldtree".
It's supposed to open a window and display an image.
And when you press ESC you get back to the menu.
I used some tutorials to create the window and draw the image, BUT whenever I open the window, I'm stuck.
I can't get back to the menu.
If I got it right (?), I need a setHandler to do this. The thing is, everytime I add the setHandler to my code I get an ERROR (TypeError undefined is not a function).
So my question is, how do these setHandlers work and what do I have to do to close the window?
Thanks in Advance
Code:
//Scene
Scene_Menu.prototype.commandWorldtree = function() {
SceneManager.push(Worldtree_Scene);
};
function Worldtree_Scene() {
this.initialize.apply(this, arguments);
}
Worldtree_Scene.prototype = Object.create(Scene_MenuBase.prototype);
Worldtree_Scene.prototype.constructor = Worldtree_Scene;
Worldtree_Scene.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Worldtree_Scene.prototype.stop = function() {
Scene_MenuBase.prototype.stop.call(this);
};
Worldtree_Scene.prototype.terminate = function() {
Scene_MenuBase.prototype.terminate.call(this);
};
Worldtree_Scene.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
};
Worldtree_Scene.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._worldtreeWindow = new Window_Worldtree(0,0);
this._worldtreeWindow.setHandler('cancel', this.popScene.bind(this));
this._worldtreeWindow.activate();
this.addWindow(this._worldtreeWindow);
};

