Constitution The core script is finally output to mainly 6 files. --- rpg_core.js Wrapper classes of Pixi.js and base classes such as audio and input processing. rpg_managers.js Static classes named XxxManager that manage the game overall. rpg_objects.js Classes named Game_Xxx dealing with game data (many are saved). rpg_scenes.js Classes named Scene_Xxx in which the scene is defined. rpg_sprites.js Classes named Sprite_Xxx related to image display and processing. rpg_windows.js Classes named Window_Xxx handling window display and input. --- In addition, a plugin list is defined in plugins.js, and main.js launches the game.
// In JavaScript this function is constructor function Derived() { this.initialize.apply(this, arguments); // Delegate to initialize() } Derived.prototype = Object.create(Base.prototype); // Derived inherits from Base Derived.prototype.constructor = Derived; Derived.prototype.initialize = function () { Base.prototype.initialize.call(this); // This makes super.initialize() sense };
【Global variables】 Variables named $dataXxx are read from JSON in the data folder. These files are changed by the editor, but they are immutable during play. Variables named $gameXxx are instances of the class defined in rpg_objects.js. When saving the game, these objects (except $gameTemp, $gameMessage, $gameTroop) are serialized to JSON and saved. When loading, since the prototype chain is reconnected simultaneously with deserialization, you can continue using instance methods.