Monster and Monster Weapon Barrier Script

tbizzle

Well-known member
If you followed the tutorial here to bring back monster weapons into your game:

You may want a tile that will not let monsters and monster weapons to not cross. So here ya go!!!!!!!! Script below, I used this with the Metroidvania Module. I haven't tested it out with any other module, still should work.

Code:
LDA Object_flags,x
    AND #%00001000
        BNE +nextThing
        LDA Object_flags,x
        AND #%00010000
           +nextThing:
    BEQ skipMonsterBlock
    LDA ObjectUpdateByte
    ORA #%00000001
    STA ObjectUpdateByte
skipMonsterBlock:
  RTS
 

dale_coop

Moderator
Staff member
Cleaner, simpler code:
Code:
LDA Object_flags,x
AND #%00011000        ;; checking "monster weapon", "monster" bits
BEQ +skipMonsterBlock    ;; if none of them is set, tile shoud be not solid
    LDA ObjectUpdateByte
    ORA #%00000001
    STA ObjectUpdateByte
+skipMonsterBlock:
  RTS
 
Top Bottom