Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Coolie_IndividualAnimDimensions.js
- //=============================================================================
- var Imported = Imported || {};
- Imported.Coolie_IndividualAnimDimensions = true;
- var Coolie = Coolie || {};
- Coolie.IAD = Coolie.IAD || {};
- Coolie.IAD.version = 1.00;
- /*:
- * @plugindesc v1.0 Coolie Individual Anim Dimensions
- * Special thanks to caethyril
- *
- * @author Coolie, caethyril
- *
- * @help
- * ---------------------------------------------------------------------
- * Coolie's Individual Animation Dimensions
- * ---------------------------------------------------------------------
- * RPG Maker MV forces a very small 192x192 size for each cell in an
- * animation. This is way too small for an engine that allows us to make
- * games with much higher resolutions.
- *
- * This plugin allows you to set the width and height of the animation
- * cells in individual animations in your database, so you can use anims
- * with cell sizes bigger (or smaller) than 192x192.
- *
- * Keep in mind, each cell must be the same width and height on BOTH
- * animation files used to create the animation.
- *
- * When the notetag to customize the animation size does not exist, the
- * animation will use the default 192x192 cell size, so the default RMMV
- * animations will not be ruined.
- *
- * ---------------------------------------------------------------------
- * NOTETAG (ANIMATION NAME)
- * ---------------------------------------------------------------------
- *
- * YourAnimationName<iad:W,H,[+/-]X,[+/-]Y>
- *
- * Just like this, do not use any spaces!
- *
- * W = the width of the animation cells for this animation (i.e. 256)
- * H = the height of the animation cells for this animation (i.e. 128)
- * X = the X offset of the animation, in case the editor doesn't allow
- * you to get it in the perfect position. Needs a + or - before it.
- * Y = the Y offset of the animation, in case the editor doesn't allow
- * you to get it in the perfect position. Needs a + or - before it.
- *
- * Example of an Animation name that would utilize this plugin:
- *
- * Fire<iad:256,128,+45,-36>
- *
- * The above example would expect an animation sheet of...
- * - Five columns at a width of 256 each, or 1,280 pixels wide
- * - Image height equaling 128 * the number of rows in the image file
- * - For a 60 cell anim, this would be 12 rows of 5, or 1,536 pixels
- * high.
- * In-game...
- * - The animation would be placed in-game +45 pixels from its X position
- * in the MV editor.
- * - The animation would be placed in-game -36 pixels from its Y position
- * in the MV editor.
- * - TIP! You can leave your animation at X/Y 0/0 in the editor and use
- * the notetag on the name to position your animation anywhere on the
- * screen!
- * - TIP! It may also be a good idea to always make each cell have an
- * EVEN value (i.e. 500x250 rather than 501x249) to ensure that the anim
- * is always properly centered where it is placed. Not required, though!
- *
- * ---------------------------------------------------------------------
- * IMPORTANT NOTE
- * ---------------------------------------------------------------------
- * The RPG Maker MV editor cannot tell that you are using a bigger or
- * smaller cell size for your animations. It will likely take trial and
- * error or an outside application to be able to properly set up your
- * animations that use these tags, such as GIMP or Photoshop.
- *
- * Accompanying this plugin with Tsukimi's 'AnimationFrameRate' plugin
- * will allow you to slow your animations down enough by adding a '%' to
- * the name of your animations, to see where to properly shift the X/Y
- * value of the animation to get it in the right place on your game's
- * screen. After it's set, you can remove the '%' from your animation
- * name to get it back to its normal speed, or speed it up with another
- * tag.
- *
- * Example:
- *
- * %Fire<iad:256,128,+45,-36>
- *
- * ---------------------------------------------------------------------
- * COMPATIBILITY
- * ---------------------------------------------------------------------
- * This plugin was written for RPG Maker MV version 1.5.1!
- * - It may not work with earlier versions, which are unsupported.
- * - Please make sure you are using version 1.5.1 before making a bug
- * report.
- *
- * This plugin only overwrites one function:
- *
- * Sprite_Animation.prototype.updateCellSprite
- *
- * If you have any other plugins that also overwrites this function, you
- * may have some issues with using this plugin. I will try my best to
- * patch for compatibility.
- *
- * ---------------------------------------------------------------------
- * TERMS OF USE
- * ---------------------------------------------------------------------
- * It is OK to use this plugin in both commercial and non-commercial
- * projects.
- *
- * Credit is appreciated, but not required. The individuals who made
- * this plugin, if you wish to credit them, are:
- *
- * - Coolie (William Couillard)
- * * Plugin author
- * - caethyril
- * * Assistance with notetags
- *
- * ---------------------------------------------------------------------
- */
- (function() {
- 'use strict';
- const alias = Scene_Boot.prototype.start;
- Scene_Boot.prototype.start = function() {
- $dataAnimations.forEach(function(obj, id) {
- if (obj) {
- const iad_note = /<iad:(\d+),(\d+),([\+\-]\d+),([\+\-]\d+)>/.exec(obj.name);
- if (iad_note !== null) {
- obj.meta || (obj.meta = {});
- obj.meta.iad = [iad_note[1], iad_note[2], iad_note[3], iad_note[4]];
- obj.meta.iad = [parseInt(iad_note[1], 10), parseInt(iad_note[2], 10), parseInt(iad_note[3], 10), parseInt(iad_note[4], 10)];
- }
- }
- });
- alias.apply(this, arguments);
- };
- })();
- Sprite_Animation.prototype.updateCellSprite = function(sprite, cell) {
- var pattern = cell[0];
- if (pattern >= 0) {
- if (this._animation.meta && this._animation.meta.iad) {
- var iad_w = this._animation.meta.iad[0];
- var iad_h = this._animation.meta.iad[1];
- var iad_x = this._animation.meta.iad[2];
- var iad_y = this._animation.meta.iad[3];
- var sx = pattern % 5 * iad_w;
- var sy = Math.floor(pattern % 100 / 5) * iad_h;
- } else {
- var sx = pattern % 5 * 192;
- var sy = Math.floor(pattern % 100 / 5) * 192;
- }
- var mirror = this._mirror;
- sprite.bitmap = pattern < 100 ? this._bitmap1 : this._bitmap2;
- if (this._animation.meta && this._animation.meta.iad) {
- sprite.setFrame(sx, sy, iad_w, iad_h);
- sprite.x = cell[1] + iad_x;
- sprite.y = cell[2] + iad_y;
- } else {
- sprite.setFrame(sx, sy, 192, 192);
- sprite.x = cell[1];
- sprite.y = cell[2];
- }
- sprite.rotation = cell[4] * Math.PI / 180;
- sprite.scale.x = cell[3] / 100;
- if(cell[5]){
- sprite.scale.x *= -1;
- }
- if(mirror){
- sprite.x *= -1;
- sprite.rotation *= -1;
- sprite.scale.x *= -1;
- }
- sprite.scale.y = cell[3] / 100;
- sprite.opacity = cell[6];
- sprite.blendMode = cell[7];
- sprite.visible = true;
- } else {
- sprite.visible = false;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement