RMMV Question About Maintaining Direction If Only Using Side-View For Walking Sprites

Grassfur

Joyful Creature
Member
Joined
Mar 29, 2018
Messages
20
Reaction score
24
First Language
English
Primarily Uses
RMMV
Hi there. So I am wanting to create sprites that only show their side views when walking (even though you can still walk up/down). While this is simple to do (just pasting side view for the typical walking up/walking down portions of the sprite), I encounter an issue when walking up and down in game. The character does not maintain the same direction when moving up or down.

side view walking example.png

For example, you can see in this image that the character only faces to the side, though I still want him to move upwards/downwards in game. When I make him walk upwards, he will always be facing to the left because the character in the sprite sheet here is facing to the left for the upwards walking animation. When he walks downwards, he will always face to the right.

I am looking for a way to make it to where, if I am walking to the right, then need to move upwards, he will still be facing right while moving upwards, and the same thing for facing to the left when moving downwards.

I greatly appreciate any advice anyone can give me regarding this issue. Thank you very much for your time!
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
832
Reaction score
671
First Language
English
Primarily Uses
RMMV
The easiest way is that you make the character's sheet all point right, then have the character's sprite's horizontal scale flip from +1 to -1 whenever they move left, and from -1 to +1 whenever they move right.

Would require a little work to implement in an event but probably not too excessive?

You'll want to dive into actual changing of the game script if you want something that doesn't require events on every page. (I have this behavior working for events as part of cross engine, but it's too snarled up with moghunter's code and unrelated features for me to give you a standalone version of it).
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,891
Reaction score
14,994
First Language
English
Primarily Uses
RMMV

Moving to Plugin Requests



You will need a plugin for this ...

Pop the following into a new file and give it whatever name you want, with a .js extension, and save into your plugins folder.

Code:
Game_Player.prototype.setDirection = function (dir) {
    if (dir == 4 || dir == 6) {
        Game_Character.prototype.setDirection.call(this, dir);
    }
};

If you only want it on sometimes, select a switch to turn on when you want the left/right-only movement, then turn the switch on and off as needed. Replace 15 below with the switch id you want to use, without leading zeros.

Code:
Game_Player.prototype.setDirection = function (dir) {
    if (!$gameSwitches.value(15) || dir == 4 || dir == 6) {
        Game_Character.prototype.setDirection.call(this, dir);
    }
};

If I wasn't being lazy, I'd put that into a plugin parameter for you. But I'm still unpacking, so that's my excuse.


Hmmm ... do you have multiple party members? If you do, and you have followers visible on the map, you'll also need to do the same for Game_Follower. Or just turn followers off for the time you need this to happen.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
832
Reaction score
671
First Language
English
Primarily Uses
RMMV
[mod]Moving to Plugin Requests[/mod]

You will need a plugin for this ...

Pop the following into a new file and give it whatever name you want, with a .js extension, and save into your plugins folder.

Code:
Game_Player.prototype.setDirection = function (dir) {
    if (dir == 4 || dir == 6) {
        Game_Character.prototype.setDirection.call(this, dir);
    }
};

If you only want it on sometimes, select a switch to turn on when you want the left/right-only movement, then turn the switch on and off as needed. Replace 15 below with the switch id you want to use, without leading zeros.

Code:
Game_Player.prototype.setDirection = function (dir) {
    if (!$gameSwitches.value(15) || dir == 4 || dir == 6) {
        Game_Character.prototype.setDirection.call(this, dir);
    }
};

If I wasn't being lazy, I'd put that into a plugin parameter for you. But I'm still unpacking, so that's my excuse.


Hmmm ... do you have multiple party members? If you do, and you have followers visible on the map, you'll also need to do the same for Game_Follower. Or just turn followers off for the time you need this to happen.
The one issue for this is with trying to trigger events above you or below you, since your interactions are going to be locked immediately left/right. Depending on what's wanted and how mapping works that might not be a problem
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,891
Reaction score
14,994
First Language
English
Primarily Uses
RMMV
Interesting ... hadn't thought of that.
 

Grassfur

Joyful Creature
Member
Joined
Mar 29, 2018
Messages
20
Reaction score
24
First Language
English
Primarily Uses
RMMV
Wow... thank you all so much for your quick replies. Both of those ideas sound very promising, I will definitely look into to trying them out. I have not really used plugins before, but it doesn't sound too difficult from your description, so I will try it. Thank you all!
 

VanillaBrocker

Veteran
Veteran
Joined
Jul 25, 2015
Messages
69
Reaction score
84
First Language
Portuguese
Primarily Uses
Yo @Grassfur ! As mentioned in the PM, I've commissioned a plugin from the amazing @dsiver144 for this feature. I've been wanting it for a long time and your request was the spark that I needed before asking someone for that. :guffaw:

dsiver said that I can post the plugin. Feel free to share it as well!
 

Attachments

  • DSI-HorizontalCharacterSprite.js
    4.1 KB · Views: 17

Grassfur

Joyful Creature
Member
Joined
Mar 29, 2018
Messages
20
Reaction score
24
First Language
English
Primarily Uses
RMMV
Yo @Grassfur ! As mentioned in the PM, I've commissioned a plugin from the amazing @dsiver144 for this feature. I've been wanting it for a long time and your request was the spark that I needed before asking someone for that. :guffaw:

dsiver said that I can post the plugin. Feel free to share it as well!
Thank you yet again! I really appreciate this, and that you decided to share it with the community!

Update: I just tried it out, and it works perfectly, no issues with events or anything else that I've noticed so far. It is also very neat, you can just use any regular RPG maker walk sprite sheet and they show side view only as well. You are a saint. Thank you again very much!
 
Last edited:

_C_Thun_

Warper
Member
Joined
Jun 25, 2021
Messages
3
Reaction score
0
First Language
Hungarian
Primarily Uses
RMMV
@VanillaBrocker
Your plugin is like holy water :LZSblush:
Would you mind if I would use it in a project that will eventually (hopefully) will be marketed?
 

Latest Threads

Latest Posts

Latest Profile Posts

Here in Fla were are seeing crazy covid spikes and some vaccinated getting bad infections. I had a mild fever on Thurs but it went down fast. How is everyone else doing. Hopefully you are all well. :)
Wish I was better at art, specifically that I was faster at it, bc this one NPC took Several Days to complete! It's gonna take So Extremely Long to do all of the art for my game, never mind writing it... Anyways, here's my gorgon, Hopernica Sthyxis!

57b88732c7abbcd84981dacf624a98495af61fcc.gifv
Idk if this is my ADHD or if it's a common problem. But I cant stay motivated for anything. I want to work on so many different things at once. Game dev, skateboarding, ranking up in League, playing OSRS, fitness, nutrition, relationships. It's like, where do I even begin?
Well. Looks like I need to redo the entire battle system in order to have the things I want in it. Also I'd like to say that console.log() is the greatest function in Javascript XD.

Forum statistics

Threads
113,817
Messages
1,077,701
Members
147,873
Latest member
tuansvip
Top