Quetz

Villager
Member
Joined
May 29, 2023
Messages
28
Reaction score
4
First Language
Español
Primarily Uses
RMMV
Hello!

I'm trying to make a game which is designed to be played with the mouse, however, I'm having issues making the character run and walk at the same time using only the mouse.

I thought of holding the click for half second would trigger the run animation, while just clicking would be the walking animation. However, my knowledge about javascript is very limited.

I wondering if anyone knows how to do this?

Thanks and sorry if my english is bad!
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,042
Reaction score
8,975
First Language
English
Primarily Uses
RMMV
Are you already using a plugin for this "run" part? If yes, which plugin?

By default, MV doesn't have any such thing as a run animation.

There is dashing, but that's just moving faster. You could probably get a not-too-complicated plugin whipped up to make you dash if you're holding down the mouse button, or maybe walk with left-click and dash with right-click.

If you need it to interact with another plugin to change the character sprites, that could be more complicated.
 

Quetz

Villager
Member
Joined
May 29, 2023
Messages
28
Reaction score
4
First Language
Español
Primarily Uses
RMMV
Are you already using a plugin for this "run" part? If yes, which plugin?

By default, MV doesn't have any such thing as a run animation.

There is dashing, but that's just moving faster. You could probably get a not-too-complicated plugin whipped up to make you dash if you're holding down the mouse button, or maybe walk with left-click and dash with right-click.

If you need it to interact with another plugin to change the character sprites, that could be more complicated.
I'm not using any run plugin. The only plugin related to movement I'm using is a Diagonal Movement one but I don't think they will interefere with each other. I was thinking just changing the sprite after the run mechanic triggers. I just have no idea how to make a plugin like that and not sure if one exists already.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,022
Reaction score
4,352
First Language
EN
Primarily Uses
RMMZ
You can try this:
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Hold touch input to run/dash, press & release to walk.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/157975/
 * @help Free to use and/or modify for any project, no credit required.
 */
// Should run during touch movement only while touch input is held.
void (function(alias) {
  Game_Player.prototype.isDashing = function() {
    if ($gameTemp.isDestinationValid())  // if touch move target is active
      return TouchInput.isPressed();
    return alias.apply(this, arguments);  // otherwise default
  };
})(Game_Player.prototype.isDashing);

// Only change move destination on new touch.
void (function(alias) {
  Scene_Map.prototype.processMapTouch = function() {
    alias.apply(this, arguments);
    this._touchCount = 0;
  };
})(Scene_Map.prototype.processMapTouch);
 

Quetz

Villager
Member
Joined
May 29, 2023
Messages
28
Reaction score
4
First Language
Español
Primarily Uses
RMMV
You can try this:
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Hold touch input to run/dash, press & release to walk.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/157975/
 * @help Free to use and/or modify for any project, no credit required.
 */
// Should run during touch movement only while touch input is held.
void (function(alias) {
  Game_Player.prototype.isDashing = function() {
    if ($gameTemp.isDestinationValid())  // if touch move target is active
      return TouchInput.isPressed();
    return alias.apply(this, arguments);  // otherwise default
  };
})(Game_Player.prototype.isDashing);

// Only change move destination on new touch.
void (function(alias) {
  Scene_Map.prototype.processMapTouch = function() {
    alias.apply(this, arguments);
    this._touchCount = 0;
  };
})(Scene_Map.prototype.processMapTouch);

Yeah! Thanks a lot for this! I really appreciate it. I'll need to tweak it a bit so it works exactly the way I want, I don't want to bother you too much so I'll try to figure it out first with some friends help.

Thanks again!
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,022
Reaction score
4,352
First Language
EN
Primarily Uses
RMMZ
You're welcome, good luck! :kaohi:
 

Latest Threads

Latest Profile Posts

Resisting the urge to bust out watching spooky things all over. I still have days until it's Halloween month, gotta ration!
Made a free sample pack + leftovers. Free Sample Pack 1
I'm curious, how many hours in RPG Maker do you have? I'm clocked in at 2100 hours on MV and the vast majority of it is for one game. I wish I could track how much I used XP back in the day, I was on it a lot.
Why is it so early? Can I have twenty more minutes of sleep, please?
DK
Do you like this design?

GIF.gif

Forum statistics

Threads
134,810
Messages
1,250,845
Members
177,606
Latest member
Buffinto
Top