Krimer

Regular
Regular
Joined
May 10, 2013
Messages
162
Reaction score
131
First Language
Ukrainian

Destination Sprite


By Krimer


Introduction


With this plugin you can change the destination place sprite of the mouse\touch input


Features
- Easy to use.
- Resize, recolor the destination sprite
- You can use custom image as the destination sprite
- Choose animation mode


Screenshots


oKnAMFO.gif



How to Use

  1. Create file with name DestinationSprite.js
  2. add file to /plugin folder of your project
  3. Activate DestinationSprite in plugin manager

Script MV

JavaScript:
//=============================================================================
// DestinationSprite.js
// Version: 1.2.3
//=============================================================================
var Imported = Imported || {};
Imported.Krimer_DestinationSprite = true;

//=============================================================================
/*:
* @plugindesc v1.2.3 - With this plugin you can change the destination place sprite of the mouse\touch input.
* <DestinationSprite>
* @author Krimer
*
* @param Sprite Figure
* @desc Sprite type. It can be - Square, Circle, or Off = hide sprite. For custom image set value to - Custom. Def:Square
* @default Square
*
* @param Custom Image
* @desc Active only if "Sprite Figure" set to "Custom". Write a name of your custom image in folder '/img/system'
* @default image
*
* @param Animation mode
* @desc Setup animation mode. Can be: Blink => standard RMMV animation; Fade => fade sprite once per click. Def:blink
* @default blink
*
* @param Fade speed
* @desc Sprite opacity decrease per frame. Active only if "Animation mode" set to "fade". Def:12
* @default 12
*
* @param Sprite Size
* @desc Sprite Size in pixels. Ignore if "Sprite Figure" set to "Custom". Default: 48
* @default 48
*
* @param Sprite Color
* @desc Sprite Color. Link where you can choose color is in "Help". Ignore if "Sprite Figure" set to "Custom". Default: #ffffff
* @default #ffffff
*
* @param Sprite Opacity
* @desc Set the sprite opacity. Write a number in range 0..255. Default: 120
* @default 120
*
* @param Sprite Blend
* @desc Set the blend mode for the destination sprite. 0=NORMAL, 1=ADD
* Default: 1
* @default 1
*
* @help Color picker can be found here or you can use any graphic editor with hex color codes:
* http://www.w3schools.com/tags/ref_colorpicker.asp
* Recommended size for Custom Images is 48x48 or not higher than your tiles size
*/
//=============================================================================

(function() {
    function capitalizeFirstLetter(string) {
        return string.charAt(0).toUpperCase() + string.slice(1);
    }

    var parameters = $plugins.filter(function(p) {
        return p.description.contains('<DestinationSprite>');
    })[0].parameters;
    var dSpriteFigure = capitalizeFirstLetter(String(parameters['Sprite Figure'] || 'Square'));
    var dAnimationMode = capitalizeFirstLetter(String(parameters['Animation mode'] || 'Blink'));
    var dFadeSpeed = String(parameters['Fade speed'] || '12');
    var dSpriteColor = String(parameters['Sprite Color'] || '#ffffff');
    var dSpriteSize = Number(parameters['Sprite Size']);
    var dCustomImage = String(parameters['Custom Image']);
    var dSpriteOpacity = Number(parameters['Sprite Opacity']);
    var dSpriteBlend = Number(parameters['Sprite Blend']);

    Sprite_Destination.prototype.createBitmap = function() {
        var tileWidth = dSpriteSize || $gameMap.tileWidth();
        var tileHeight = dSpriteSize || $gameMap.tileHeight();
        this.bitmap = new Bitmap(tileWidth, tileHeight);
        if (dSpriteFigure == 'Square') {
            this.bitmap.fillAll(dSpriteColor);
        } else if (dSpriteFigure == 'Circle') {
            this.bitmap.drawCircle(this.bitmap.width / 2, this.bitmap.height / 2, dSpriteSize / 2, dSpriteColor);
        } else if (dSpriteFigure == 'Off') {} else if (dSpriteFigure == 'Custom') {
            this.bitmap = ImageManager.loadSystem(dCustomImage)
        }
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
        this.blendMode = (dSpriteBlend == 1) ? Graphics.BLEND_ADD : Graphics.BLEND_NORMAL;
    };

    Sprite_Destination.prototype.updateAnimation = function() {
        this._frameCount++;
        this._frameCount %= 20;
        if (dAnimationMode == "Blink") {
            this.opacity = dSpriteOpacity === 255 ? 255 : Math.floor(dSpriteOpacity / 6 - this._frameCount) * 6;
            this.scale.x = 1 + this._frameCount / 20;
            this.scale.y = this.scale.x;
        } else if (dAnimationMode == "Fade" && $gameTemp.getDestinationOpacity() > 0) {
            this.opacity = $gameTemp.getDestinationOpacity() - dFadeSpeed;
            $gameTemp.setDestinationOpacity(this.opacity);
        }
    };

    var Game_Temp_initialize_dAlias = Game_Temp.prototype.initialize;
    Game_Temp.prototype.initialize = function() {
        Game_Temp_initialize_dAlias.call(this);
        this._destinationOpacity = null;
    };

    Game_Temp.prototype.setDestinationOpacity = function(value) {
        this._destinationOpacity = value;
    };

    Game_Temp.prototype.getDestinationOpacity = function() {
        return this._destinationOpacity;
    };

    var Game_Temp_setDestination_dAlias = Game_Temp.prototype.setDestination;
    Game_Temp.prototype.setDestination = function(x, y) {
        if (dAnimationMode == "Fade" && (this._destinationX !== x || this._destinationY != y)) {
            this._destinationOpacity = 255;
        }
        Game_Temp_setDestination_dAlias.call(this, x, y);

    };
})();

Script MZ
JavaScript:
//=============================================================================
// DestinationSprite.js
// Version: 1.0.0
//=============================================================================
var Imported = Imported || {};
Imported.Krimer_DestinationSprite = true;

//=============================================================================
/*:
* @plugindesc v1.0.0 - With this plugin you can change the destination place sprite of the mouse\touch input.
* <DestinationSprite>
* @author Krimer
* @target MZ
*
* @param Sprite Figure
* @desc Sprite type. It can be - Square, Circle, or Off = hide sprite. For custom image set value to - Custom. Def:Square
* @type select
* @option Square
* @option Circle
* @option Off
* @option Custom
* @default Square
*
* @param Custom Image
* @desc Active only if "Sprite Figure" set to "Custom". Write a name of your custom image in folder '/img/system'
* @default image
*
* @param Animation mode
* @desc Setup animation mode. Can be: Blink => standard RMMV animation; Fade => fade sprite once per click. Def:blink
* @type select
* @option Blink
* @option Fade
* @default Blink
*
* @param Fade speed
* @desc Sprite opacity decrease per frame. Active only if "Animation mode" set to "fade". Def:12
* @default 12
*
* @param Sprite Size
* @desc Sprite Size in pixels. Ignore if "Sprite Figure" set to "Custom". Default: 48
* @default 48
*
* @param Sprite Color
* @desc Sprite Color. Link where you can choose color is in "Help". Ignore if "Sprite Figure" set to "Custom". Default: #ffffff
* @default #ffffff
*
* @param Sprite Opacity
* @desc Set the sprite opacity. Write a number in range 0..255. Default: 120
* @default 120
*
* @param Sprite Blend
* @desc Set the blend mode for the destination sprite. 0=NORMAL, 1=ADD. Default: 1
* @type select
* @option 0
* @option 1
* @default 1
*
* @help Color picker can be found here or you can use any graphic editor with hex color codes:
* http://www.w3schools.com/tags/ref_colorpicker.asp
* Recommended size for Custom Images is 48x48 or not higher than your tiles size
*/
//=============================================================================

(function() {
    function capitalizeFirstLetter(string) {
        return string.charAt(0).toUpperCase() + string.slice(1);
    }

    var parameters = $plugins.filter(function(p) {
        return p.description.contains('<DestinationSprite>');
    })[0].parameters;
    var dSpriteFigure = capitalizeFirstLetter(String(parameters['Sprite Figure'] || 'Square'));
    var dAnimationMode = capitalizeFirstLetter(String(parameters['Animation mode'] || 'Blink'));
    var dFadeSpeed = String(parameters['Fade speed'] || '12');
    var dSpriteColor = String(parameters['Sprite Color'] || '#ffffff');
    var dSpriteSize = Number(parameters['Sprite Size']);
    var dCustomImage = String(parameters['Custom Image']);
    var dSpriteOpacity = Number(parameters['Sprite Opacity']);
    var dSpriteBlend = Number(parameters['Sprite Blend']);

    Sprite_Destination.prototype.createBitmap = function() {
        const tileWidth = dSpriteSize || $gameMap.tileWidth();
        const tileHeight = dSpriteSize || $gameMap.tileHeight();
        this.bitmap = new Bitmap(tileWidth, tileHeight);
        if (dSpriteFigure == 'Square') {
            this.bitmap.fillAll(dSpriteColor);
        } else if (dSpriteFigure == 'Circle') {
            this.bitmap.drawCircle(this.bitmap.width / 2, this.bitmap.height / 2, dSpriteSize / 2, dSpriteColor);
        } else if (dSpriteFigure == 'Off') {} else if (dSpriteFigure == 'Custom') {
            this.bitmap = ImageManager.loadSystem(dCustomImage)
        }
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
        this.blendMode = dSpriteBlend;
    };
  

    Sprite_Destination.prototype.updateAnimation = function() {
        this._frameCount++;
        this._frameCount %= 20;
        if (dAnimationMode == "Blink") {
            this.opacity = dSpriteOpacity === 255 ? 255 : Math.floor(dSpriteOpacity / 6 - this._frameCount) * 6;
            this.scale.x = 1 + this._frameCount / 20;
            this.scale.y = this.scale.x;
        } else if (dAnimationMode == "Fade" && $gameTemp.getDestinationOpacity() > 0) {
            this.opacity = $gameTemp.getDestinationOpacity() - dFadeSpeed;
            $gameTemp.setDestinationOpacity(this.opacity);
        }
    }; 

    var Game_Temp_initialize_dAlias = Game_Temp.prototype.initialize;
    Game_Temp.prototype.initialize = function() {
        Game_Temp_initialize_dAlias.call(this);
        this._destinationOpacity = null;
    };

    Game_Temp.prototype.setDestinationOpacity = function(value) {
        this._destinationOpacity = value;
    };

    Game_Temp.prototype.getDestinationOpacity = function() {
        return this._destinationOpacity;
    };

    var Game_Temp_setDestination_dAlias = Game_Temp.prototype.setDestination;
    Game_Temp.prototype.setDestination = function(x, y) {
        if (dAnimationMode == "Fade" && (this._destinationX !== x || this._destinationY != y)) {
            this._destinationOpacity = 255;
        }
        Game_Temp_setDestination_dAlias.call(this, x, y);

    };
})();


Author's Notes


Sorry my English is not that good but i want to share my first plugin with you.


Free to use. You can use it as you want. If you want you can write my name in credits or not :)
 
Last edited:

VanillaBrocker

Regular
Regular
Joined
Jul 25, 2015
Messages
70
Reaction score
88
First Language
Portuguese
Primarily Uses
Thanks! I always hated the square shape on click. Haha!
 
 

Cvrtis

Regular
Regular
Joined
Sep 9, 2013
Messages
239
Reaction score
128
First Language
Russian
Primarily Uses
Cool! It solved this problem for me:

Krimer-Destination.1448286969.png


Is it possible to add some options like changing transparence? And more different shapes (for example, a cross, or a, err, heart, star)? Or maybe we can loat a picture for shape by ourself?
 
Last edited by a moderator:

??????

Diabolical Codemaster
Regular
Joined
May 11, 2012
Messages
6,547
Reaction score
3,316
First Language
Binary
Primarily Uses
RMMZ
awwww damn :/

I didnt even realize someone had done this when I made my plugin for it the other day :'(
 

Cvrtis

Regular
Regular
Joined
Sep 9, 2013
Messages
239
Reaction score
128
First Language
Russian
Primarily Uses
awwww damn :/

I didnt even realize someone had done this when I made my plugin for it the other day :'(
I saw minimum 3 "Skip Title" plugins. And all with different code.

And You are too well known to be sad by such things.

Maybe he can make the same by other way.

On other hand, You can compare Your work and develop Your skill.

UPD. Sorry, I changed my comment.
 
Last edited by a moderator:

??????

Diabolical Codemaster
Regular
Joined
May 11, 2012
Messages
6,547
Reaction score
3,316
First Language
Binary
Primarily Uses
RMMZ
I already looked at the code to compare. I feel mine is the better plugin, but thats not relevant to the fact this one seems to do the job fine too :D
 

Cvrtis

Regular
Regular
Joined
Sep 9, 2013
Messages
239
Reaction score
128
First Language
Russian
Primarily Uses
I already looked at the code to compare. I feel mine is the better plugin, but thats not relevant to the fact this one seems to do the job fine too :D
I hope he will not leave a plugin because someone passed him. Because now he can do it better then Your plugin  :guffaw:

Anyway, I will waiting.
 
Last edited by a moderator:

Krimer

Regular
Regular
Joined
May 10, 2013
Messages
162
Reaction score
131
First Language
Ukrainian
awwww damn :/


I didnt even realize someone had done this when I made my plugin for it the other day :'(

Its fine :) My plugin is for anyone who looking for something simple or just want to hide destination sprite(hide was the main reason for this plugin). Your plugin much better :)

Cool! It solved this problem for me:


Krimer-Destination.1448286969.png



Is it possible to add some options like changing transparence? And more different shapes (for example, a cross, or a, err, heart, star)? Or maybe we can loat a picture for shape by ourself?

I think we can speak russian here? Because for me its more easier to talk.

Я просто немного не понял, ты хочешь чтобы я поправил то, что на скрине? Или как? Если да, то когда это происходит? возможно это из-за небольшого конфликта плагинов.


Насчет других форм и прозрачности, то я посмотрю, что из этого выйдет. Но как я говорил, этот плагин и не рассчитывался как что-то сильно крутое с кучей настроек
 
Last edited by a moderator:

Cvrtis

Regular
Regular
Joined
Sep 9, 2013
Messages
239
Reaction score
128
First Language
Russian
Primarily Uses
Its fine :) My plugin is for anyone who looking for something simple or just want to hide destination sprite(hide was the main reason for this plugin). Your plugin much better :)

I think we can speak russian here? Because for me its more easier to talk.

Я просто немного не понял, ты хочешь чтобы я поправил то, что на скрине? Или как? Если да, то когда это происходит? возможно это из-за небольшого конфликта плагинов.

Насчет других форм и прозрачности, то я посмотрю, что из этого выйдет. Но как я говорил, этот плагин и не рассчитывался как что-то сильно крутое с кучей настроек :)
Nope! Forbidden! I'm serious :)

I will write to the PM.
 

Krimer

Regular
Regular
Joined
May 10, 2013
Messages
162
Reaction score
131
First Language
Ukrainian
Plugin was updated to version 1.1

  • Now you can set custom image as destination sprite
  • customize opacity
  • on/off blend mode.
 

Cvrtis

Regular
Regular
Joined
Sep 9, 2013
Messages
239
Reaction score
128
First Language
Russian
Primarily Uses
Yaw, You are so fast! I did not expect so soon update  :D

UPD.

On screenshot it looks not so funny  :(

Untitled.1448544014.png
 
Last edited by a moderator:

Fullereno

Regular
Regular
Joined
Nov 2, 2015
Messages
61
Reaction score
15
First Language
Spanish
Primarily Uses
I've been looking for something like this for so long... Thank you sooooo much :D
 

Jonforum

Regular
Regular
Joined
Mar 28, 2016
Messages
1,641
Reaction score
1,477
First Language
French
Primarily Uses
RMMV
@Krimer


nice thanks a lot friend.


Q: if i add custom image, we able to disable blinking and make only a fadeout ?
 

Jonforum

Regular
Regular
Joined
Mar 28, 2016
Messages
1,641
Reaction score
1,477
First Language
French
Primarily Uses
RMMV
No In current version.


What do you mean by fadeout?

something like this, 
Remove the blinking and only do one fade out when click to a position.


AJAX-Animations-Fade1.gif
 

Krimer

Regular
Regular
Joined
May 10, 2013
Messages
162
Reaction score
131
First Language
Ukrainian
Plugin was updated to version 1.2

  • Some minor changes
  • Added animation mode

Now you can choose between standard RMMV animation and fade animation once per click. 


I changed opacity setting so pay attention to it and set it to new format.

5c75020dca34f24be4873924565f4e88.gif
 
Last edited by a moderator:

Jonforum

Regular
Regular
Joined
Mar 28, 2016
Messages
1,641
Reaction score
1,477
First Language
French
Primarily Uses
RMMV
really awesome thank friend
 

Latest Threads

Latest Profile Posts

AAAGH... I hate navigating the new RPG Maker website!
Forgive my rudimentary video editing skills, thought I'd start sharing progress on my status posts as well. Here's the second character of my roster, Mǽlhafoc, the Ælven ranger.

And if you missed the first one many moons ago, here's Vilhelm, the tarnished knight.
Knocked through three more rough draft sprites. (A frog beast thing, a skeleton, and vampire bat) down to seven sprites and a thing more appropriately done as tiles.

Forum statistics

Threads
135,012
Messages
1,252,901
Members
177,928
Latest member
jayster
Top