Hi, I've been trying to emulate the movement of a pendulum and it's proving to be rather hard. I have managed to do something that resembles it but if I make it move faster the change of movement feels too abrupt, and the Y coordinate is hard to keep steady (I tried to anchor it).
Here I'm using a birdscage instead of a pendulum (I didn't make the picture).
Here is the mini video LINK
The question is: does anyone know if there is a better way to approach this? Or something to emulate the "cushion" movement on the edges?
This is how I have it now (Custom Scene_Title):
I load 2 pictures, one static (the "holder") and the other the chain&body together. Then I anchor the Y of the moving picture to the middle as precise as I can and rotate it.
Here I'm using a birdscage instead of a pendulum (I didn't make the picture).
Here is the mini video LINK
The question is: does anyone know if there is a better way to approach this? Or something to emulate the "cushion" movement on the edges?
This is how I have it now (Custom Scene_Title):
I load 2 pictures, one static (the "holder") and the other the chain&body together. Then I anchor the Y of the moving picture to the middle as precise as I can and rotate it.
Code:
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;
}
}
};



