Bucket Mouse
Active member
When a monster gets hurt, they're supposed to stop moving. I have a monster set to follow the player and it won't stop moving when it gets attacked, even though I clearly have it set up that way. When I change the AI to Random Movement, the monster obeys the "stop moving" command. But not with the other thing.
Here are the two scripts so you can compare them. I don't understand what one is doing that the other isn't.
This is Stop Moving:
This is Move Random 8 Directions:
And this is Move Towards Player:
Do you see anything that could make it not work?
Here are the two scripts so you can compare them. I don't understand what one is doing that the other isn't.
This is Stop Moving:
Code:
LDA Object_direction,x
AND #%00001111
STA Object_direction,x
This is Move Random 8 Directions:
Code:
TXA
STA tempA
JSR doGetRandomNumber
AND #%00000111
TAY
LDA DirectionTable,y
STA tempB
LDA FacingTable,y
STA tempC
StartMoving tempA, tempB, #$00
ChangeFacingDirection tempA, tempC
And this is Move Towards Player:
Code:
;;; aim towards player.
TYA
PHA
TXA
PHA
STA tempx
LDA Object_x_hi,x
STA tempA
LDA Object_y_hi,x
STA tempB
LDX player1_object
LDA Object_x_hi,x
STA tempC
LDA Object_y_hi,x
STA tempD
LDX tempx
MoveTowardsPoint tempA, tempC, tempB, tempD
LDA Object_direction,x
AND #%00000111
ORA #%00001000
STA Object_direction,x
PLA
TAX
PLA
TAY
Do you see anything that could make it not work?