Diagonal Movement & VX Ace

Discussion in 'RGSSx Script Support' started by Wavelength, Jul 25, 2014.

  1. Wavelength

    Wavelength Pre-Merge Boot Moderator

    Messages:
    4,434
    Likes Received:
    3,714
    Location:
    Florida, USA
    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
     
    #1
  2. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,925
    Likes Received:
    10,636
    First Language:
    English
    Primarily Uses:
    RMVXA
    #2
  3. Chiakscare

    Chiakscare Resident Tifaholic Veteran

    Messages:
    489
    Likes Received:
    148
    Location:
    Crystal Lake, IL
    First Language:
    English
    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...
     
    #3
  4. Tommy Gun

    Tommy Gun ♩ ♪ ♫ ♬ Veteran

    Messages:
    385
    Likes Received:
    120
    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.
     
    #4
    Wavelength likes this.
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,793
    Likes Received:
    11,502
    Location:
    Australia
    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?
     
    #5
  6. Wavelength

    Wavelength Pre-Merge Boot Moderator

    Messages:
    4,434
    Likes Received:
    3,714
    Location:
    Florida, USA
    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!:

     
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,793
    Likes Received:
    11,502
    Location:
    Australia
    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: Jul 27, 2014
    #7
    Wavelength likes this.
  8. Wavelength

    Wavelength Pre-Merge Boot Moderator

    Messages:
    4,434
    Likes Received:
    3,714
    Location:
    Florida, USA
    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.
     
    #8
  9. Shaz

    Shaz Veteran Veteran

    Messages:
    37,793
    Likes Received:
    11,502
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes. Because Ace only has 4 directions for a character sprite.
     
    #9

Share This Page