Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- /*:
- @plugindesc Este plugin permite que você mostre
- animações em imagens no mapa.
- @author Alisson
- @help Para mostrar uma animação, use o seguinte
- comando: Prism.SpriteAnim(n1, n2, wait)
- n1: O número da imagem no mapa.
- n2: O número da animação no database.
- wait: true ou false, faz com que ele espere a animação terminar.
- @param Ajuste X
- @desc Ajusta a posição da animação horizontalmente.
- Valores negativos ajustam para a esquerda.
- @default 0.0
- @param Ajuste Y
- @desc Ajusta a posição da animação verticalmente.
- Valores negativos ajustam para cima.
- @default 0.0
- */
- Prism.makeAlias("spInit", Sprite_Picture.prototype.initialize);
- Sprite_Picture.prototype.initialize = function () {
- Prism.getAlias("spInit").apply(this, arguments);
- this._animationSprite = new Sprite_Base ();
- this.addChild(this._animationSprite);
- };
- Prism.makeAlias("spUp", Sprite_Picture.prototype.update);
- Sprite_Picture.prototype.update = function () {
- Prism.getAlias("spUp").apply(this, arguments);
- var pic = this.picture(this._pictureId);
- if (pic && pic._reservedAnimation) {
- this._executeAnimation();
- }
- if (pic && this._animationSprite) {
- if (this.bitmap.isReady()) {
- var pa = PluginManager.parameters("PictureAnimations");
- var numX = Number(pa["Ajuste X"] || 0.0);
- var numY = Number(pa["Ajuste Y"] || 0.0);
- if (this._animationSprite.x != this.bitmap.width * (0.5 + numX)) {
- this._animationSprite.x = this.bitmap.width * (0.5 + numX);
- }
- if (this._animationSprite.y != this.bitmap.height * (0.5 + numY)) {
- this._animationSprite.y = this.bitmap.height * (0.5 + numY);
- }
- }
- if (this._animationSprite.isAnimationPlaying()) {
- $gameScreen._pictures[this._pictureId]._waitingAnimation = true;
- } else if (!this._animationSprite.isAnimationPlaying()) {
- $gameScreen._pictures[this._pictureId]._waitingAnimation = false;
- }
- }
- }
- Sprite_Picture.prototype._executeAnimation = function () {
- var anim = this.picture(this._pictureId)._reservedAnimation;
- this._animationSprite.startAnimation(anim);
- $gameScreen._pictures[this._pictureId]._reservedAnimation = null;
- }
- Game_Picture.prototype._requestAnimation = function (anim, wait) {
- this._reservedAnimation = anim;
- if (wait) {
- this._waitingAnimation = true;
- }
- }
- Prism.makeAlias("giUWM", Game_Interpreter.prototype.updateWaitMode);
- Game_Interpreter.prototype.updateWaitMode = function () {
- if (this._waitMode === 'imageAnimation') {
- return $gameScreen._pictures[this._spAnimId]._waitingAnimation;
- } else {
- return Prism.getAlias("giUWM").call(this);
- }
- }
- Prism.SpriteAnim = function (id, anid, wait) {
- $gameMap._interpreter._showSpriteAnimation(id, anid, wait);
- }
- Game_Interpreter.prototype._showSpriteAnimation = function (id, anid, wait) {
- var anim = $dataAnimations[anid];
- var img = $gameScreen._pictures[id];
- this._spAnimId = id;
- if (img) {
- $gameScreen._pictures[id]._requestAnimation(anim, wait);
- this.setWaitMode('imageAnimation');
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement