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,156
Reaction score
9,104
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,031
Reaction score
4,372
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,031
Reaction score
4,372
First Language
EN
Primarily Uses
RMMZ
You're welcome, good luck! :kaohi:
 

Latest Threads

Latest Profile Posts

Definitely leaning on the "try to" part of the status feed rule and I really try not to sad post, but not only is my kitty Simone more or less confirmed to have IBD... but she has some pulmonary edema and a slightly enlarged heart. They say everything is early and mild and that I'm very diligent and observant about my pets but iunno...doesn't feel like a win right now.


So it turns out music is fun to make????
A lil concept for a prison level. It's intentional that the chords and sound is the same from the previous concept I posted cause it's related to a certain character... What do u think?
I was wondering if I should ask the question
"Who Is Dalph?"
But I met him pretty fast and his answer was extremely helpful. So yeah. That probably answers it.
So in hindsight, I could have made a double-post in this category instead of setting up a post on a different site and figuring out how to share and then linking...

Forum statistics

Threads
134,907
Messages
1,251,810
Members
177,728
Latest member
keilahm776
Top