I have a workaround to get this to work that isn't very clean but it's been working for me. You will need an input script and an additional tile script.
Here is what I want to accomplish for Pokémon like movement:
1. I press UP on my D-pad and my input script will start moving my player upwards.
2. When the player is on the center of a tile, the player should be stopped or keep going if I am still holding my up arrow.
Number 1 is easy, I just use this script and assign it to your "hold" "up" input:
Code:
TXA
STA temp
StartMoving temp, #UP
TXA
STA temp ;; assumes the object we want to move is in x.
ChangeFacingDirection temp, #FACE_UP
RTS
It will move my player up and even if I let go of my input, the player still moves up.
But (for number 2) we need it to stop whenever the player hits the center of any tile in front of them. The issue is that we cannot use the input script as the script only fires off when there is user input. So if you put the logic, to check if your player is on the center of tile, in the moving script, the script might terminate before that check can even happen because your player might let go of the UP arrow early!
So to combat this we need another script that is constantly checking for if a player in on the center of a tile. The easiest I found was to put that logic into the tile's themselves. The tiles will fire off their scripts whenever they experience a collision with an object. All we have to do is check for only the player object and see if their position is divisible by 16 (which will fire off if player is at center of any tile). Here is the script:
Code:
;;
CPX player1_object ;; see if player is colliding with me
BNE +skip
LDX player1_object
LDA Object_y_hi,x
AND #15
BNE +notDivBy16 ;this filters out any y position that isn't divisible by 16
;PlaySound #sfx_powerup
TXA
STA temp
StopMoving temp, #$FF, #$00
RTS
+notDivBy16
RTS
+skip
If you let go of the input and encounter a collision with a tile, the script will stop you at the nearest tile that is in front of you.
Now I don't know for sure why, but if you HOLD up arrow, you will keep moving up, but as soon as you let go of the input, your player will stop at the center of the nearest tile in front of them! Not sure how THAT part is working but I won't argue with that extra functionality!
You will need to change all of your screen tiles to this new tiletype with this script, but I hope this will help you figure out a better solution. I will leave the other directions for you. Let me know if this works or you find something better!