[4.5.6] AI Control the movement no randoms.

Not sure if this has been shared or not.

So here is the code that lets me control the movements of monsters for chrono knight.

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Directions 
; to use with movement byte.
; These pertain to actual physics inertia,
; not facing directions.
;DOWN = #%00110000
;UP = #%00100000
;LEFT = #%10000000
;RIGHT = #%11000000

;DOWNRIGHT = #%11110000
;UPRIGHT	= #%11100000
;UPLEFT = #%10100000
;DOWNLEFT = #%10110000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Facing direction, for animation engine.
;; These determine which facing direction the sprite uses.
;FACE_DOWN = #%00000000
;FACE_DOWNRIGHT = #%00000001
;FACE_RIGHT = #%00000010
;FACE_UPRIGHT = #%00000011
;FACE_UP = #%00000100
;FACE_UPLEFT = #%00000101
;FACE_LEFT = #%00000110
;FACE_DOWNLEFT = #%00000111


	TXA	
	STA tempA ; object
	JSR doGetRandomNumber
	AND #%00000111
	TAY
	
	StartMoving tempA, #%00100000 , #$00 ; SET TO UP
	ChangeFacingDirection tempA, #%00100000   ; SET TO FACE UP
 

The_Siege

New member
I would really like some elaboration on where to insert this script. I can almost get this when I have a monster set to move towards player and its speed is set high enough. I sort of stumbled across something like this one night by accident. I would like to use this as a feature in my game where two monsters will PERSISTANT dummy ghost with the player through rooms and then stop when you get to a certain room. In fact can I build a player off of a monster tileset instead of a game object tileset?
 

Jonny

Well-known member
I'd like to second that. Where would you put this code and how? Does this involve the action steps?
It's an action step for moving by the looks of it. I'm confused by the title 'no randoms' but then calls the doGetRandomNumber subroutine in the script?
From what I can gather, this will select a monster at random and move it UP?? I'll try it out to be sure but I think you could just assign it to any monsters action step.
 
Top Bottom