4.5.9 "Monster Block" Metroidvania

DocNES

Member
Looking for a little assembly help. Would like to setup my monsters (or some) to not yeet themselves off edges. But stop and change directions at the edge of a platform.
Been digging through the forum, and saw this was in 4.1 but was removed.
Was think an invisible block, that only monster collision would care about. But not sure how to go about it yet.
 

SciNEStist

Well-known member
same principle applies as before, you take a regular solid block code, that looks like this:

Code:
LDA ObjectUpdateByte
ORA #%00000001
STA ObjectUpdateByte ;; makes solid
RTS

then you add a check to see if the colliding object has the monster flag checked, which looks like this:

Code:
LDA Object_flags,x ; x is whatever is being tested against the tile
AND #%00001000 ;; is it a monster?  (4th flag is for monsters)
BEQ +skipMonsterBlock;; skip ahead if it isnt checked

LDA ObjectUpdateByte
ORA #%00000001                        ;;the normal solid tile stuff
STA ObjectUpdateByte

+skipMonsterBlock
RTS
 

DocNES

Member
same principle applies as before, you take a regular solid block code, that looks like this:

Code:
LDA ObjectUpdateByte
ORA #%00000001
STA ObjectUpdateByte ;; makes solid
RTS

then you add a check to see if the colliding object has the monster flag checked, which looks like this:

Code:
LDA Object_flags,x ; x is whatever is being tested against the tile
AND #%00001000 ;; is it a monster?  (4th flag is for monsters)
BEQ +skipMonsterBlock;; skip ahead if it isnt checked

LDA ObjectUpdateByte
ORA #%00000001                        ;;the normal solid tile stuff
STA ObjectUpdateByte

+skipMonsterBlock
RTS
Thank you, I'll give it a try in my game!
 
Top Bottom