I am not sure if it is from my lack of understanding of ASM or my lack on knowledge with NES Maker, probably both. I am not able to alter how monsters move within my game. I am trying to have monsters move up, when they reach a point on the screen, move down. Think of a bouncing ball.
I am using the simple shooter module as a base. I created a script, see below, added it to AI_12 and added it as an action to my monster. I tried to loop and repeat as an end action. I have also swapped out using yPrev with my a user variable I created called previous. I have tried to use the hard coded values as binary and hex, same effect. I can get the monster to move up but it never stops nor comes down, just keeps flying off the screen.
I feel part of my problem is using yPrev. I think this is only used with aimed physics, which I am not using. That still does not explain why using a variable did not work, maybe I have to reference it differently I am not sure of the value that is actually stored in Object_y_hi and can't really find anything that states its use. I did find many scripts using it and it seems like I am doing things correctly but clearly I am not.
Any help with this would be greatly appreciated. I am really trying to understand all of this but not being able to make a simple script is a major hurdle I need to get over.
I am using the simple shooter module as a base. I created a script, see below, added it to AI_12 and added it as an action to my monster. I tried to loop and repeat as an end action. I have also swapped out using yPrev with my a user variable I created called previous. I have tried to use the hard coded values as binary and hex, same effect. I can get the monster to move up but it never stops nor comes down, just keeps flying off the screen.
Code:
LDA Object_y_hi,x
CMP #$23
BEQ moveDown
CMP #$80
BEQ moveUp
CMP yPrev
BCC moveUp
moveDown:
STA yPrev
LDA #MOVE_DOWN
JMP done
moveUp:
STA yPrev
LDA #MOVE_UP
JMP done
done:
STA Object_movement,x
I feel part of my problem is using yPrev. I think this is only used with aimed physics, which I am not using. That still does not explain why using a variable did not work, maybe I have to reference it differently I am not sure of the value that is actually stored in Object_y_hi and can't really find anything that states its use. I did find many scripts using it and it seems like I am doing things correctly but clearly I am not.
Any help with this would be greatly appreciated. I am really trying to understand all of this but not being able to make a simple script is a major hurdle I need to get over.