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

User avatar
MistSonata
Posts: 232
Joined: Fri Feb 16, 2018 7:10 am

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

Post by MistSonata » Fri Aug 24, 2018 1:10 am

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: Select all

 .include "Routines\UserScripts\movement_tables.txt"
It should now look like this:
Image
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)
Image
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.45 KiB) Downloaded 29 times
Last edited by MistSonata on Mon Aug 27, 2018 6:16 pm, edited 2 times in total.
User avatar
MistSonata
Posts: 232
Joined: Fri Feb 16, 2018 7:10 am

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

Post by MistSonata » Fri Aug 24, 2018 1:21 am

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: Select all

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

UserMovementTable:
.db %00110000, %11110001, %11000010, %11100011, %00100100, %10100101, %10000110, %10110111
User avatar
Convoy_Avenger
Posts: 63
Joined: Tue Aug 14, 2018 1:42 am

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

Post by Convoy_Avenger » Fri Aug 24, 2018 2:11 am

I don't need 8 directional movement right now, but this looks awesome.
regularJim
Posts: 7
Joined: Thu Aug 09, 2018 5:44 pm

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

Post by regularJim » Fri Aug 24, 2018 4:22 am

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.
User avatar
MistSonata
Posts: 232
Joined: Fri Feb 16, 2018 7:10 am

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

Post by MistSonata » Fri Aug 24, 2018 4:34 am

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?
User avatar
WolfMerrik
Posts: 199
Joined: Sat Aug 11, 2018 4:59 pm
Location: Maine
Contact:

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

Post by WolfMerrik » Fri Aug 24, 2018 5:32 am

Wow, this is totally RAD! I definitely will have to try this out, thanks for sharing!
MistSonata wrote:
Fri Aug 24, 2018 1:21 am
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!
ImageWant to download & share Image NESMaker Resources? Check out My Files on www.NESMakerFiles.com Image
Bucket Mouse
Posts: 180
Joined: Wed Mar 07, 2018 2:25 am

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

Post by Bucket Mouse » Fri Aug 24, 2018 10:06 am

If you listen closely, Mist, you'll hear this slapping noise in the distance....that's me applauding you.
User avatar
MistSonata
Posts: 232
Joined: Fri Feb 16, 2018 7:10 am

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

Post by MistSonata » Fri Aug 24, 2018 4:01 pm

Bucket Mouse wrote:
Fri Aug 24, 2018 10:06 am
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
Posts: 7
Joined: Thu Aug 09, 2018 5:44 pm

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

Post by regularJim » Sat Aug 25, 2018 3:56 am

MistSonata wrote:
Fri Aug 24, 2018 4:34 am
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.
User avatar
dale_coop
Posts: 1302
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Sat Aug 25, 2018 5:14 pm

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!)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply