4.5.9 Bring Back Monster Weapons (Maze Module) and Others!

TolerantX

Active member
If your "doHandleObjectCollisions.asm" is missing the area for monster weapons or they seem to be not working for you try this:
Using the script of the same name above in Maze module as a base at line 98 you'll see the end of your monster player collision section.
"+notPlayerMonsterCollision:"
on Line 99 (Object Collisions MazeBase)
(*edit line 166 in Object Collisions ArcadePlatformerBase)
(*edit Line 153 in AdventureBase2)

paste the following script in:

Code:
;;;;;;; THIS IS WHERE I WANT TO ADD A CHECK FOR MONSTER WEAPON ;;;;;;;

                            LDA Object_flags,x
                            AND #%00010000
                            BNE +isPlayerMonsterWeaponCol
                                JMP +isNotPlayerMonsterWeaponCol
                            +isPlayerMonsterWeaponCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BNE +doCollision
                                    JMP +skipCollision
                                +doCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a monster weapon.
                                    ;; player is self.
                                    ;; monster weapon is other.
                               
                                    ;DestroyObject                    ;; normally we destroy it because its a weapon ;;
                                    LDX selfObject                    ;; 9Panzer edit ;;    
                                    JSR doHandleHurtPlayer
                                    JMP +done
       
                        +isNotPlayerMonsterWeaponCol:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I made a youtube video below to show you just how easy it can be!

NESMaker how to make Monster Weapons Work in 30 seconds...

View: https://youtu.be/KN1BFoLevts
 
Last edited:

baardbi

Member
Two questions. Is this the monster "Shoot at player" we had in 4.1.5? And also, do you know if it works in the metroidvania / platform modules?
 

TolerantX

Active member
This is making Monster Weapon Object flag type actually work. this method works in EVERY module as long as you follow directions where to put it.
 

9Panzer

Well-known member
Okay one minor tweak to this code. I found that if the player is repeated hit by the monster weapon and was using an action step timer to reset then it would be stuck in a loop.
If you add LDX selfObject to the bottom it fixes that right up:


;;;;;;; THIS IS WHERE I WANT TO ADD A CHECK FOR MONSTER WEAPON ;;;;;;;

LDA Object_flags,x
AND #%00010000
BNE +isPlayerMonsterWeaponCol
JMP +isNotPlayerMonsterWeaponCol
+isPlayerMonsterWeaponCol
JSR getOtherColBox
JSR doCompareBoundingBoxes
BNE +doCollision
JMP +skipCollision
+doCollision
TXA
STA otherObject
;; There was a collision between a player and a monster weapon.
;; player is self.
;; monster weapon is other.

;DestroyObject ;; normally we destroy it because its a weapon ;;
LDX selfObject
JSR doHandleHurtPlayer
JMP +done

+isNotPlayerMonsterWeaponCol:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 

TolerantX

Active member
Okay one minor tweak to this code. I found that if the player is repeated hit by the monster weapon and was using an action step timer to reset then it would be stuck in a loop.
If you add LDX selfObject to the bottom it fixes that right up:
Thank You!
 

ResidentEmil

New member
Found an easier 1 line fix on 4.5.9, (ArcadePlatformerBase), Subroutines/doHandleObjectCollisions_ArcadePlatformerBase.asm line 139

Change:

LDA Object_flags,x
AND #%00001000

to
LDA Object_flags,x
AND #%00011000

so if either monster or monster weapon are selected, the zero flag wont be set, and the code continues to the doHandleHurtPlayer action

btw this approach doesnt allow the monster weapon to be destroyed, it goes through the player, but for me thats fine, since the projectile goes fast and gets destroyed on edge/solid
 
Top Bottom