pigeonaut
Member
Hey everyone!
I was wondering how one could check for the player's facing-direction from a tile collision. Here is what I tried:
I found the variable Object_direction under the "object variables" tab in the project settings. Under the nodes its states this:
I tried to code this:
And this:
But neither of them played a sound when my player was facing the up direction when I collided with my custom tile script. Only when I collided with the tile, while facing down or right, is when the sound triggered.
00000101 was also down or right
00000110 was down only
and 00000000 was any facing direction triggered the tile.
I was not able to figure out any other combination of these last 3 bits that gave me just a single facing direction.
I found out the proper player direction values from this link: https://www.nesmakers.com/index.php?threads/if-left-is-00000110-what-are-the-other-directions.6636/ But none of those gave me the expected output.
1. Do any of you know how to properly check for player direction?
2. In this line: LDA Object_direction,x. What does ",x" do? And I noticed that ",y" and "" could be placed there instead.
3. According to the notes, Object_direction is in the format: xxxxZyyy, where yyy is the facing direction. Is there a way I could only compare for those last 3 bits (5-7) and would that be the solution to my issue?
Thanks for reading! I really appreciate any tips or help.
I was wondering how one could check for the player's facing-direction from a tile collision. Here is what I tried:
I found the variable Object_direction under the "object variables" tab in the project settings. Under the nodes its states this:
Code:
xxxxZyyy
Where xxxx = inertial direction for physics
Where yyy = facing direction for animation
Where z = bit flip for aimed movement.
I tried to code this:
Code:
......
LDA Object_direction,x
AND #%00000100 ;;up direction
BNE +notUpDir
;play a sound
+notUpDir
.......
And this:
Code:
LDA Object_direction,x
AND #%00000100 ;;up direction
;play a sound
BNE +notUpDir
But neither of them played a sound when my player was facing the up direction when I collided with my custom tile script. Only when I collided with the tile, while facing down or right, is when the sound triggered.
00000101 was also down or right
00000110 was down only
and 00000000 was any facing direction triggered the tile.
I was not able to figure out any other combination of these last 3 bits that gave me just a single facing direction.
I found out the proper player direction values from this link: https://www.nesmakers.com/index.php?threads/if-left-is-00000110-what-are-the-other-directions.6636/ But none of those gave me the expected output.
1. Do any of you know how to properly check for player direction?
2. In this line: LDA Object_direction,x. What does ",x" do? And I noticed that ",y" and "" could be placed there instead.
3. According to the notes, Object_direction is in the format: xxxxZyyy, where yyy is the facing direction. Is there a way I could only compare for those last 3 bits (5-7) and would that be the solution to my issue?
Thanks for reading! I really appreciate any tips or help.