Scene_Title.prototype.create = function() {
Scene_Base.prototype.create.call(this);
this.createBackground();
this.createPendulo(); // Here I create the 2 pictures.
this.createForeground();
this.createWindowLayer();
this.createCommandWindow();
this._commandWindow.opacity = 0;
this.createPictureCommands();
};
Scene_Title.prototype.createPendulo = function() {
this.createJailChainAndBody(); //Moving
this.createJailHolder(); //Static
};
Scene_Title.prototype.createJailHolder = function() {
this._jailHolder = new Sprite();
this._jailHolder.bitmap = ImageManager.loadPicture('JailHolder');
this._jailHolder.x = 600;
this._jailHolder.y = 0;
this.addChild(this._jailHolder);
};
Scene_Title.prototype.createJailChainAndBody = function() {
this._jailChainAndBody = new Sprite();
this._jailChainAndBody.bitmap = ImageManager.loadPicture('JailChainAndBody');
this._jailChainAndBody.x = 610;
this._jailChainAndBody.y = 20;
this._jailChainAndBody.anchor.x = 0.50;
this._jailChainAndBody.anchor.y = 0;
this.addChild(this._jailChainAndBody);
};
Scene_Title.prototype.update = function() {
if (!this.isBusy()) {
this._commandWindow.open();
}
Scene_Base.prototype.update.call(this);
this.updatePictureCommands();
this.updateJailChainAndBodyPosition(); // Here I Update the Chain&Body Picture.
};
Scene_Title.prototype.start = function() {
Scene_Base.prototype.start.call(this);
SceneManager.clearStack();
this.centerSprite(this._titleBackground);
this.playTitleMusic();
this._isGoingRight = false; // Here I define the condition for the movement
};
Scene_Title.prototype.updateJailChainAndBodyPosition = function() {
if (this._isGoingRight === false) {
this._jailChainAndBody.rotation += 0.0002;
if (this._jailChainAndBody.rotation >= 0.0100) {
this._isGoingRight = true;
}
}
if (this._isGoingRight === true) {
this._jailChainAndBody.rotation -= 0.0002;
if (this._jailChainAndBody.rotation <= -0.0100) {
this._isGoingRight = false;
}
}
};