Monster not moving

I made a new AI for my monster, however, when I place him, he doesn't do anything. Is this a glitch, or is it my code that's the problem?
Here's the code. It's an updated version of Bucket Mouse's move towards player script I made. Tell me if there is something wrong with it.
Code:
LDY player1_object ;;load player object into Y register
     ;; Note: if this is an ai script, X should already be loaded with the current object, so no need to worry about that.

     LDA #$00
     STA temp ;;this is just to zero out the variable in case there's something there leftover from another script

     LDA Object_x_hi,y
     CMP Object_x_hi,x
     BCC playerIsToMyLeft ;;BCC or "branch on carry clear" acts as a "is this value less than the value I'm comparing it to?" after a compare instruction 
     ;; If it didn't branch, that means the player is to my right

     LDA #%000000010
	 STA Object_movement,x
	 TAY
	 LDA DirectionMovementTable,y
     STA temp
	 TYA
	 ORA temp
	 STA Object_movement,x
     JMP skiptoAboveBelowCheck

playerIsToMyLeft:
     BEQ skiptoAboveBelowCheck ;;since we only checked for "less than", we need to branch if both values are the same

     LDA #%000000110
	 STA Object_movement,x
	 TAY
	 LDA DirectionMovementTable,y
	 STA temp
	 TYA
     ORA temp
     STA Object_movement,x

skiptoAboveBelowCheck:

     LDA Object_y_hi,y
     CMP Object_y_hi,x
     BCC playerIsAboveMe

     LDA #%000000000
	 STA Object_movement,x
	 TAY
	 LDA DirectionMovementTable,y
	 STA temp
	 TYA
     ORA temp
     STA Object_movement,x
     JMP endMoveTowardPlayer

playerIsAboveMe:
     BEQ endMoveTowardPlayer

     LDA #%000000100
	 STA  Object_movement,x
	 TAY
	 LDA DirectionMovementTable,y
	 STA temp
	 TYA
     ORA temp
     STA Object_movement,x

endMoveTowardPlayer:

     LDA temp ;; temp should now be loaded with the movement information we want, and we can now store it in this object's Object_movement variable, which will make it move.
     STA Object_movement,x

     ;; no RTS because it's an AI script, and they manage subroutines and returns already
 

rimoJO

Member
Hmm... it might be the code, but it might also be your monster. Could you share the "Details" tab of your monster and the Action Steps it uses? Or, if you don't like sharing screenshots, which is completely normal, you could also message me a .ZIP file containing your .MONSTER file for your monster by exporting your monster via a button in the top bar in your NESM window. Hope that helps.
EDIT: If this is in the platformer module, and you're sharing screenshots, please send a screenshot of your monster's hitbox in the "Bounding Box" tab.
 
I managed to fix it, but now instead of moving towards the player, they move back and forth between the top left and bottom right corner of the screen.
 
Top Bottom