Diagonal Movement & VX Ace

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I've gotten so used to the 4-way movement in VX Ace that when I was looking through the default Character/Event scripts the other day, I was shocked to see methods specifically designed around diagonal movement and passability.  I took a second (okay, hundredth) glance at the "Move Route" editor and saw that, yeah, I'd missed the potential for setting diagonal movement this whole time.

But a few things still seem weird to me.  After all, by default, the player can only move in 4 directions (outside of forced Move Routes).  Events set to approach (or move away from) the player will only move in 4 directions.  Conditional branches that check the direction a character/event is facing only have 4 options.

Can someone please explain what the purpose of diagonal movement might be (aside from a smoother look in cutscenes), and how passability/Event Touch detection/conditional branch "direction" checks operate when a character is moving diagonally?  And while I know there are a few complete "diagonal movement" scripts out there, such as Victor's, would it be reasonably easy for me to script in the ability for the player to move diagonally whenever they're holding down two directional buttons?

Any clarity is much appreciated - thanks so much! :D
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA

Chiakscare

Resident Tifaholic
Veteran
Joined
Jul 24, 2014
Messages
489
Reaction score
148
First Language
English
Primarily Uses
Well, I know when I see that saucy innkeeper to my diagonal right, I don't want to move right and then up to drop my awful pick-up lines! AMIRITE?!

Ahem...

Yes, it is pretty simple to script; as mentioned above there are several already available. As for the question of Conditional Branch checking, I am not sure. I looked in the Conditional Branch section of events and didn't find anything for it... do you mean in the script editor, or am I missing something...
 

Tommy Gun

♩ ♪ ♫ ♬
Veteran
Joined
Jan 20, 2014
Messages
385
Reaction score
123
First Language
English
I stopped using diagonal movement because characters can walk through objects diagonally -- like if you're facing up and there's a block to your left, and you move up/left, you'll walk through part of it (which could be a wall you're walking over). It looks weird. I don't know if any of the scripts fix that, or have options for that.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


It would be quite easy to script a condition for player holding down two buttons, I think, but maybe not so easy for the player. The script would detect the first button pressed, and it's INCREDIBLY unlikely that they're going to press BOTH buttons in exactly the same millisecond. So they'll start on a 4-d movement, then the second key would register, but the movement has already started and will continue to go just horizontally or vertically even though they've got two keys down. If they continue to hold them down, the second and subsequent moves should work.


However, you said you've seen the diagonal movement scripts. Isn't that exactly what they do?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Thanks to all of you guys for the insight so far into how movement works.

I'm not specifically looking for scripts to do anything in particular, but trying to gain a better understanding of how VX Ace "interprets" a character (player or event) that is moving diagonally, since there are so many different event commands and script methods that rely on character direction just a few that let you set it diagonally.  (As one example of why I'm trying to understand this better, I'm developing an action battle system where enemies can shoot projectiles at you if they're facing you... but I have no idea what VX Ace would think about where they're "facing" if I had these enemies moving diagonally.)

From what you guys have said, it sounds like while the foundation is there to change a bit of code and allow the game to determine whether the player is holding down multiple buttons (at least after it runs through the "step" once), some of the other handling (like collision detection, as Tommy Gun mentioned) is only handled in a crude 4-directional manner.  I'm guessing Event Touch and conditional "which way is the event facing" branches would be handled in the same way?

Once again, thanks to you guys for the info, and I would love any further insight that anyone has as to how VX Ace understands a character's movement and direction. :cutesmile:

Oh, and amen to this!:

Well, I know when I see that saucy innkeeper to my diagonal right, I don't want to move right and then up to drop my awful pick-up lines! AMIRITE?!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Action Button / Event Touch / Player Touch only look horizontally and vertically.


In order to move diagonally, the engine determines if the player or event can move into the adjacent tile horizontally or vertically, and then from there into the destination tile. So it does 2 passability checks if necessary, and only denies the movement if they both come back negative. Then it does a diagonal movement rather than two separate movements to cover the intermediate tile as well.
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
That's extremely helpful, Shaz, thank you so much!

I would never have dreamed that the passability would be judged in segments like that.  With this in mind, I was able to look through the movement methods and understand them a little better.

It looks like a character's direction is set to a single up/down/left/right value (2/4/6/8) even after a diagonal move, if I'm reading the scripts right.  I find that pretty bizarre.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yes. Because Ace only has 4 directions for a character sprite.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top