Trying to read directional movement

Hi everyone, I was working on this tutorial,
However, as the tutorial explains, I have a variable for player direction (2,6,8,4) for Down, Right, Up and Left. So I have conditional branches that shoot projectiles in the given direction based on that variable.

Pretty simple, but I was hoping 9,7,1, and 3 would work as diagonal, but they don't seem to. So I tried a branch that checks for up AND Right and it still didn't seem to work.

Surely there's an easy way to do this, or a chunk of script. Thanks!
Tutorials is where people who have written a tutorial for others to use can post it.

Moved to: RPG Maker MV
If this requires a plugin, please Report this post and ask for the thread to be moved to JS Plugin Requests.
Diagonal movement is only possible in MV with a plugin.

If you HAVE a plugin that allows diagonal movement, then it would also have a way to detect that the player is facing in a diagonal direction. But we would have to know what that plugin is, in order to tell you how to check for that.
Tutorials is where people who have written a tutorial for others to use can post it.

Moved to: RPG Maker MV
If this requires a plugin, please Report this post and ask for the thread to be moved to JS Plugin Requests.
Appreciate the help, thanks.
Diagonal movement is only possible in MV with a plugin.

If you HAVE a plugin that allows diagonal movement, then it would also have a way to detect that the player is facing in a diagonal direction. But we would have to know what that plugin is, in order to tell you how to check for that.
Ah, makes sense. I am using GALVs diagonal movement.
Got a link so I don't have to go searching for it?
Got a link so I don't have to go searching for it?
Yeah sure, right here: https://galvs-scripts.com/2015/12/12/mv-diagonal-movement/
Okay - you didn't actually say how you're getting the direction into the variable. But with that script enabled, you should be able to do
Control Variables: YourVariable = Script: $gamePlayer.getInputDirection();
which should return the original 4 straight directions, as well as 1, 3, 7 and 9 for the diagonal directions.

If you can't get this to work, please show a screenshot of your plugin manager, and a screenshot of your event where you're trying to check the direction.
Okay - you didn't actually say how you're getting the direction into the variable. But with that script enabled, you should be able to do
Control Variables: YourVariable = Script: $gamePlayer.getInputDirection();
which should return the original 4 straight directions, as well as 1, 3, 7 and 9 for the diagonal directions.

If you can't get this to work, please show a screenshot of your plugin manager, and a screenshot of your event where you're trying to check the direction.
Hey, thanks again. I tried it out, but it seems to bring up some issues that I can't really explain. My screenshot here shows how I get my Player Direction, and my conditional branches using them. Essentially what I want to do is fire projectiles on an angle.

What I used to use was Galvs Map Projectiles, which was really great because I could simply fire my projectiles at Mouse position, which is essentially what I'm hoping to do. However, that plugin isn't quite working with all the other ways I've decided to manage my gameplay, so I've stopped using it since.
So you can't use that kind of conditional branch, because it only caters for the 4 directions. You'd have to use a script call instead. However, I realise what I gave you is the direction according to the keys pressed, but what you want is the actual facing direction even though keys may not be being pressed.

This is a directional movement plugin, not an 8dir sprite plugin, so there must be another you have for that.

Try something like this ...
Code:
Control Variables 50 Player Direction = Script: $gamePlayer._diagDir > 0 ? $gamePlayer._diagDir : $gamePlayer.direction()

If the above doesn't work, please give a link to the plugin you're using for the 8dir sprites, as we'll be able to check to see which row of the spritesheet is active, and that will give the direction.
So you can't use that kind of conditional branch, because it only caters for the 4 directions. You'd have to use a script call instead. However, I realise what I gave you is the direction according to the keys pressed, but what you want is the actual facing direction even though keys may not be being pressed.

This is a directional movement plugin, not an 8dir sprite plugin, so there must be another you have for that.

Try something like this ...
Code:
Control Variables 50 Player Direction = Script: $gamePlayer._diagDir > 0 ? $gamePlayer._diagDir : $gamePlayer.direction()

If the above doesn't work, please give a link to the plugin you're using for the 8dir sprites, as we'll be able to check to see which row of the spritesheet is active, and that will give the direction.
Yeah, the MapProjectiles shoots on diagonals too. But GALVS diagonal has an option to use diagonal sprites. I'm not so concerned about the gamePlayer using a diagonal sprite, I'm trying to shoot my projectile (another event) diagonally. If you check out the video I linked at the top real quick, it shows him shooting a chicken, I essentially used this method as reference, but instead of just the 4 directions, I'd like to shoot at least 8. However, what I'm really working towards is firing towards mouse position. Which is a whole new ballgame lol.
Did you try the code above? What happened?
Script: $gamePlayer._diagDir > 0 ? $gamePlayer._diagDir : $gamePlayer.direction()
Seems to do the exact same thing as what I'm working with. Shoots in the 4 directions.
Edit: I have to fool around with it more, once I started walking on an angle I realized that I think it's actually working, but I have no conditions set up for it. I'll let you know.
Edit#2: I set up conditions and it seems to work. The only downfall is that it only works while moving directional, so if I'm still (against an object in which I can move) then it's shooting either up or straight ahead. This is pretty cool though. Ideally I'd like to set up a button press to stand still if I did it this way, like in Diablo when you press "Shift" and you can stand still and shoot projectiles. Thanks for all your help!

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-read-directional-movement.117002/