4.5.6 Monster Turn Tile?

Craigery

Active member
So I took the code for the TurnDirection AI_reaction and tried to make it a tile that would cause the monster to turn Clockwise or CounterCW when they collide, but it just causes the monster to reverse direction. This is a scrolling game and my monsters solid reaction is set to null.

Code:
	LDA Object_type,x
	AND #%00010000
	BNE doTurnTile
	JMP +skip


doTurnTile:
;;;; turn direction, counterclockwise.
	LDA Object_direction,x
	AND #%00000111
	CLC
	ADC #$01
	AND #%00000111
	TAY ;; this is the "direction", where
		;; 0 = down, counterclockwise, 7=down-left
	LDA DirectionTableOrdered,y
	ORA FacingTableOrdered,y
	STA Object_direction,x
	
	+skip

I also wonder how to make it go clockwise. Would that just be changing that line 12 to ADC #$FF?
 
Top Bottom