I'm a newbie on RPG Maker and after I bought MZ, I tried to convert a simple code that displays a Window_Base upon pressing G button from es5 to es6 using a tutorial here. However, adding a constructor to my class that extends Window_Base like in the turorial throws an unidentified 'x' error.
Here's my working code:
The above code actually works. But upon adding this code to WindowGambit
It throws the error. Am I doing something wrong? What does a constructor actually do? It seems like SceneGambit still works with or without a constructor. Thanks for helping me!
Here's my working code:
JavaScript:
Input.keyMapper["71"] = "openGambitMenu";
_alias_scene_map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function()
{
_alias_scene_map_update.call(this);
if(Input.isTriggered("openGambitMenu")) SceneManager.push(SceneGambit);
}
class WindowGambit extends Window_Base
{
}
class SceneGambit extends Scene_MenuBase
{
create()
{
super.create();
var rect = new Rectangle(100, 200, 500, 300);
this._customWindow = new WindowGambit(rect);
this._customWindow.drawText("First Box", 0, 0);
this.addWindow(this._customWindow);
}
}
SceneGambit.prototype.update = function()
{
Scene_MenuBase.prototype.update.call(this);
if(Input.isTriggered("cancel")) SceneManager.pop();
}
The above code actually works. But upon adding this code to WindowGambit
Code:
constructor(){
super();
}