8-Directional Movement Script (and how to install it!)

MistSonata

Moderator
QUICK NOTE: This script doesn't work quite as seamlessly with the melee script as I'd like, but apart from that it allows for smooth 8-directional movement. If your melee weapon is showing up in odd places, make sure you've set up the weapon offsets for your diagonal directions.

Here's a quick demonstration of the movement script in action!


Step 1: Download the rar file and export to the UserScripts folder in your NESmaker.
You should be able to find it at the bottom of the post, if that doesn't work for you I'll post it on the NESmaker Files website here soon.


Step 2: Open your MainASM.asm file and, near the bottom right after ".include "GameData\HUD_DEFINES.dat"", insert the following code:
Code:
 .include "Routines\UserScripts\movement_tables.txt"
It should now look like this:
8680f9111203720038a1d59bf077c644.png

Important: make sure the movement_tables.txt file is in UserScripts and not a subfolder, otherwise it won't find it.


Step 3: Load the movement_8direction.asm file into your Input Scripts and set up your Input Manager like so:
(ignore the b_create_melee.asm one, that's from testing it with the melee script)
ce5c9a1ff59954e16703888e182cc191.png

Link the script to each individual directional button Press and Release so that it updates seamlessly when you change direction.


Step 4: You're done! Bask in the buttery smooth 8-directional movement goodness!


TROUBLESHOOTING NOTES:
If you're having trouble, please read these!
  • If the game is freezing on you when you press one or all of the directions, try making sure that you have at least 4-5 scripts loaded in your Input Scripts. For some reason it sometimes gives these scripts trouble if there's only one or two scripts in there.
  • It's recommended that you set your character's acceleration to max when using this script. While this script works with lower accelerations, the way NESmaker handles acceleration sometimes makes your movement act strangely. (For instance, if you hold up for a few seconds and then quickly tap down, your character will continue accelerating upward despite not pressing any of the d-pad buttons.
 

Attachments

  • 8dirmovement.rar
    67.4 KB · Views: 211

MistSonata

Moderator
Here's a link to the asm file on the NESmaker Files website.

Unfortunately it won't let me post the rar file or the movement_tables.txt file with it, so here's the code that's in that file...

Code:
 DpadTable:
.db %00100000, %10100000, %10000000, %10010000, %00010000, %01010000, %01000000, %01100000
;;   [ ↓ ]      [ ↘ ]      [ → ]      [ ↗ ]      [ ↑ ]      [ ↖ ]      [ ← ]      [ ↙ ]

UserMovementTable:
.db %00110000, %11110001, %11000010, %11100011, %00100100, %10100101, %10000110, %10110111
 

regularJim

New member
Shouldn't the inputs be tied to Player 1, not NULL?

Also, I've tried both ways (NULL as in the image shows, and Player 1) and I can't get my player character to move. I've set his speed and acceleration too.

EDIT: I've also put the Movement tables file in the right place, and edited the MainASM file.
 

MistSonata

Moderator
Right now the Target part of the Input Manager isn't functional. It might make sense to select player1, but you might introduce rogue variables that will mess up your code.

Have you made sure your player has "PERSISTENT" and "Player" checked in object details?
 

WolfMerrik

New member
Wow, this is totally RAD! I definitely will have to try this out, thanks for sharing!

MistSonata said:
Unfortunately it won't let me post the rar file or the movement_tables.txt file with it, so here's the code that's in that file...

I added the text file here and linked between them (ill change it so it's posted in your name in a bit) I also added a section for misc files and includes/etc. Ill change some stuff around and allow for archives/zips/rars soon.

Again, Awesome stuff! Thanks for sharing!
 

MistSonata

Moderator
Bucket Mouse said:
If you listen closely, Mist, you'll hear this slapping noise in the distance....that's me applauding you.

Whew, that's a relief. I thought that sound might be something else...
(adulthumorlol)
 

regularJim

New member
MistSonata said:
Right now the Target part of the Input Manager isn't functional. It might make sense to select player1, but you might introduce rogue variables that will mess up your code.

Have you made sure your player has "PERSISTENT" and "Player" checked in object details?

Yes my player character is set to Persistant and Player. I also renamed it Player1, hoping that would help. Alas, it did not.
 

dale_coop

Moderator
Staff member
regularJim, could you share some screenshots of your input editor, player object details...? You might have missed something.
I just copied the files, installer, set and it works very well, on my project! (congrats & thanks MistSonata, great work!)
 

Mihoshi20

Member
It's great seeing an update to this. I used a large portion of this code during the Beta for Mermay's Den, though made a few modifications to it myself to get the full functionality I wanted. I'll have to give this new iteration a go sometime.
 

regularJim

New member
I don't know, everything looks correct. I also loaded the Adventure Module. Don't know if that matters

zIX5xS.jpg


wP7Sjl.jpg


And I'm pretty sure I have my player character placed on walkable tiles.
 

regularJim

New member
Okay, so strange thing happening. I think the script was working. BUT, when I press up and/or left my character doesn't move, and no longer can move. Because when the game starts I can press down and right, and my character will move freely in those directions. Until I press up or left, then I will no longer be able to move at all.
 

MistSonata

Moderator
Have you tried loading in about 4-5 dummy scripts? It sounds like the game is freezing up on you.

Just make a bunch of blank .asm files and load them into input scripts. Let me know if that works.
 

WolfMerrik

New member
This just occurred to me today, this could even be useful in a platformer.
Namely for shooting in 8 directions (think metal blades in MM2, the best weapon ever)

shoot8dir.gif


I didn't make platformer physics or anything like that when i tried it, but it could definitely work for it.
 
WolfMerrik said:
This just occurred to me today, this could even be useful in a platformer.
Namely for shooting in 8 directions (think metal blades in MM2, the best weapon ever)

shoot8dir.gif


I didn't make platformer physics or anything like that when i tried it, but it could definitely work for it.

so it can be used as a Contra like Shooter physics neat!
 

DanielT1985

Member
Speaking of 8-Direction movement, for some reason, all of the enemy movement choices related to moving up and down cause my enemies to go side by side. Is there a way to fix this?

(Using: Platformula 4.0.11)
 
Top Bottom