[4.5.9] [SOLVED] Official Strategy Guide tutorial - Problems with shooting monsters and ammo pickup

Peter Schmitz

Active member
Hi - after finally starting with Nesmaker and deciding to start with the official strategy guide's tutorial (PDF ) I kinda ran into two problems. Everything up to page 209 is running well - I am able to shoot the bullet and it gets destroyed when colliding with a solid object. But to shoot a monster and make it disappear or to destroy it - the guide tells me to use the common script " Handle Monster Hurt" and assign the script "doHandleHurtMonster.asm" - I did that but nothing happens.

When I look at the "doHandleHurtMonster.asm" script - it just has the 2nd line "DestroyObject". -> is that supposed to be just one line or is something missing?
Don't I have to somewhere tell Nesmaker when to use the script Handle Monster Hurt or refer to that script when the projectile hits the monster object?

Moreover - on page 216 I am supposed to define the "PickUp script" by assigning the "templatePickUpScript.asm" file. -> This gives me the error that the game.nes file can not be found.
The "templatePickUpScript.asm" differs from the picture in the guide and when I change it to match the lines in the guide it works - so somehow the additional lines are messing things up.

So - if someone can help me out how to destroy a monster (in this case the crab) I would be very grateful =)

By the way - to get help like in my case - is here the best place to ask or on facebook.com or discord?
 

SciNEStist

Well-known member
"DestroyObject" is all you need in that line. whatever is currently loaded into "x" will be the object it destorys.

I find a good way of sorting out any issues you might have is to build a "dummy" game of with the same module using the beginner tutorial assets and videos HERE

that way, if something like the code breaks or gets too confusing, you can always go back to see how it was done there.
 

Peter Schmitz

Active member
"DestroyObject" is all you need in that line. whatever is currently loaded into "x" will be the object it destorys.

I find a good way of sorting out any issues you might have is to build a "dummy" game of with the same module using the beginner tutorial assets and videos HERE

that way, if something like the code breaks or gets too confusing, you can always go back to see how it was done there.
Thanks, but actually that is the 'dummy' game from that learning site. I just didn't use one of the beginner modules because I first wanted to start with the guide at the top. I kinda think that the monster object is not in x but I have absolutely no idea how I can check that.

I did everything step by step - the projectile / bullet is set to player weapon (monster flag) and the crab is set to monster (monster flag).

I can run into the crab and lose a life , the crab doesn't move through solid objects. It just doesn't let me destroy it šŸ˜…
 

Peter Schmitz

Active member
What module are you using ?
If it's the Maze, you will need to modify the handle object collision script in order to get any collision between a "player weapon" and a "monster" object.
check that topic: https://www.nesmakers.com/index.php?threads/solved-projectile-on-maze-module-help-4-5-6.6420/
I am using the Tutorial modul 'Tutorial 4_5_X.mod' -- and after line 55 it says
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
           
            LDA Object_flags,x
            AND #%00000010
            BNE +isPlayerForCol
                ;; not player for collions
                    JMP +notPlayerForCollisions
            +isPlayerForCol
                ;;; check against monsters.
                    LDX #$00
                    loop_objectPlayerCollisions:
                        CPX selfObject
                        BNE +notSelfObject
                            JMP +skipCollision
                        +notSelfObject
                        LDA Object_status,x
                        AND #%10000000
                        BNE +isActive
                            JMP +skipCollision
                        +isActive
                        LDA Object_flags,x
                        AND #%00001000
                        BNE +isPlayerMonsterCol
                            JMP +notPlayerMonsterCollision
                        +isPlayerMonsterCol
                           
                            JSR getOtherColBox
                            JSR doCompareBoundingBoxes
                                ;;; if they have collided, it is a 1
                                ;;; if not, it is a zero.
                                BNE +dontSkipCol
                                    JMP +skipCollision
                                +dontSkipCol
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a monster and a weapon.
                                    ;; player is self.
                                    ;; monster is other.
                                    ;JMP RESET
                           
                                        JSR doHandleHurtPlayer
                               
                                    JMP +done
                                   
                        +notPlayerMonsterCollision:
                       
                            LDA Object_flags,x
                            AND #%00100000
                            BNE +isPlayerPowerupCol
                                JMP +isNotPlayerPowerupCol
                            +isPlayerPowerupCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BNE +doCollision
                                    JMP +skipCollision
                                +doCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    DestroyObject
                                    .include SCR_PICKUP_SCRIPTS
                                    JMP +done
                                   
                        +isNotPlayerPowerupCol  
                            LDA Object_flags,x
                            AND #%10000000
                            BNE +isPlayerNPCCol
                                JMP +isNotPlayerNPCCol
                            +isPlayerNPCCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BEQ +skipCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    TXA
                                    PHA
                                        LDX selfObject
                                        LDA xPrev
                                        STA Object_x_hi,x
                                        STA xHold_hi
                                       
                                        LDA yPrev
                                        STA Object_y_hi,x
                                        STA yHold_hi
                                       
                                        LDA #$00
                                        STA Object_h_speed_lo,x
                                        STA Object_h_speed_hi,x
                                        STA Object_v_speed_lo,x
                                        STA Object_v_speed_hi,x
                                        STA Object_x_lo,x
                                        STA Object_y_lo,x
                                    PLA
                                    TAX
                                    JMP +done
                                   
                            +isNotPlayerNPCCol
                           
                            +skipCollision
                   
                            INX
                            CPX #TOTAL_MAX_OBJECTS
                            BEQ +lastCollisionForThisObject
                                JMP loop_objectPlayerCollisions
                            +lastCollisionForThisObject
                            ; PLA
                            ; TAX
                            JMP +done
                       
                           
                            ;; Add other object to object collision types here.
                        JMP +done
                           
           
        +notPlayerForCollisions
   
+done  
    PLA
    TAY
    PLA
    TAX
+skipObjectCollisionCheck
    ReturnBank

It's a bit different to yours but the Handle Object Collision does point to the Module Maze and its subroutine doHandleObjectCollisions_MazeBase.asm
 
Last edited:

Peter Schmitz

Active member
What module are you using ?
If it's the Maze, you will need to modify the handle object collision script in order to get any collision between a "player weapon" and a "monster" object.
check that topic: https://www.nesmakers.com/index.php?threads/solved-projectile-on-maze-module-help-4-5-6.6420/
Hey Dale - you pushed me to the right direction =) I solved the problem. I also took a glance at the doHandleObjectCollisions.asm of the AdventureBase Mod and there is an entry about Monster/Weapon Collision which is not in the Maze mod - so I used this script and now it is working =)

Thanks =)
 

warpedpipe

New member
Hey Dale - you pushed me to the right direction =) I solved the problem. I also took a glance at the doHandleObjectCollisions.asm of the AdventureBase Mod and there is an entry about Monster/Weapon Collision which is not in the Maze mod - so I used this script and now it is working =)

Thanks =)

Thanks for the tips. Im having the same issue with the Strategy Guide Tutorial. I was able to solve it by adding this code from the adventure module as mentioned. Delete everything after line 55 comment and use code below.

Code:
;;; Check the type of object.
;;; If it is a weapon, it will check against monsters only.
        LDA Object_flags,x
        AND #%00000100
        BNE +isWeapon
            JMP +notPlayerWeapon
        +isWeapon

                LDX #$00
                loop_objectCollision:
                    CPX selfObject
                        BNE +notSelfObject
                            JMP +skipCollision
                        +notSelfObject
                LDA Object_status,x
                AND #%10000000
                BNE +isActive
                    JMP +skipCollision
                +isActive:
                LDA Object_flags,x
                AND #%00001000
                BNE isMonsterWeaponCol
                    JMP +notAmonsterWeaponCollision
                isMonsterWeaponCol:
                    JSR getOtherColBox
                    JSR doCompareBoundingBoxes
                        ;;; if they have collided, it is a 1
                        ;;; if not, it is a zero.
                        BEQ +skipCollision
                            TXA
                            STA otherObject
                            ;; There was a collision between a monster and a weapon.
                            ;; weapon is self.
                            ;; monster is other.
                            ;DestroyObject
                            ;ChangeActionStep otherObject, #$07
                            
                                JSR doHandleHurtMonster
                                
                            ;LDX selfObject
                            ;;DestroyObject
                            ;LDX otherObject
                            JMP +done               
                    +skipCollision
                +notAmonsterWeaponCollision
                INX
                CPX #TOTAL_MAX_OBJECTS
                BEQ +lastCollisionForThisObject
                    JMP loop_objectCollision
            +lastCollisionForThisObject
            JMP +done
            
            
        +notPlayerWeapon
            
            LDA Object_flags,x
            AND #%00000010
            BNE +isPlayerForCol
                ;; not player for collions
                    JMP +notPlayerForCollisions
            +isPlayerForCol
                ;;; check against monsters.
                    LDX #$00
                    loop_objectPlayerCollisions:
                        CPX selfObject
                        BNE +notSelfObject
                            JMP +skipCollision
                        +notSelfObject
                        LDA Object_status,x
                        AND #%10000000
                        BNE +isActive
                            JMP +skipCollision
                        +isActive
                        LDA Object_flags,x
                        AND #%00001000
                        BNE +isPlayerMonsterCol
                            JMP +notPlayerMonsterCollision
                        +isPlayerMonsterCol
                            
                            JSR getOtherColBox
                            JSR doCompareBoundingBoxes
                                ;;; if they have collided, it is a 1
                                ;;; if not, it is a zero.
                                BNE +dontSkipCol
                                    JMP +skipCollision
                                +dontSkipCol
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a monster and a weapon.
                                    ;; player is self.
                                    ;; monster is other.
                                    ;JMP RESET
                                    
                                        JSR doHandleHurtPlayer
                                    
                                    JMP +done
                                    
                        +notPlayerMonsterCollision:
                        
                            LDA Object_flags,x
                            AND #%00100000
                            BNE +isPlayerPowerupCol
                                JMP +isNotPlayerPowerupCol
                            +isPlayerPowerupCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BNE +doCollision
                                    JMP +skipCollision
                                +doCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    DestroyObject
                                    .include SCR_PICKUP_SCRIPTS
                                    JMP +done
                                    
                        +isNotPlayerPowerupCol   
                            LDA Object_flags,x
                            AND #%10000000
                            BNE +isPlayerNPCCol
                                JMP +isNotPlayerNPCCol
                            +isPlayerNPCCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BEQ +skipCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    TXA
                                    PHA
                                        LDX selfObject
                                        LDA xPrev
                                        STA Object_x_hi,x
                                        STA xHold_hi
                                        
                                        LDA yPrev
                                        STA Object_y_hi,x
                                        STA yHold_hi
                                        
                                        LDA #$00
                                        STA Object_h_speed_lo,x
                                        STA Object_h_speed_hi,x
                                        STA Object_v_speed_lo,x
                                        STA Object_v_speed_hi,x
                                        STA Object_x_lo,x
                                        STA Object_y_lo,x
                                    PLA
                                    TAX
                                    JMP +done
                                    
                            +isNotPlayerNPCCol
                            
                            +skipCollision
                    
                            INX
                            CPX #TOTAL_MAX_OBJECTS
                            BEQ +lastCollisionForThisObject
                                JMP loop_objectPlayerCollisions
                            +lastCollisionForThisObject
                            ; PLA
                            ; TAX
                            JMP +done
                        
                            
                            ;; Add other object to object collision types here.
                        JMP +done
                            
            
        +notPlayerForCollisions
    
+done   
    PLA
    TAY
    PLA
    TAX
+skipObjectCollisionCheck
    ReturnBank
 

mikusz3

Member
Thanks for the tips. Im having the same issue with the Strategy Guide Tutorial. I was able to solve it by adding this code from the adventure module as mentioned. Delete everything after line 55 comment and use code below.

Code:
;;; Check the type of object.
;;; If it is a weapon, it will check against monsters only.
        LDA Object_flags,x
        AND #%00000100
        BNE +isWeapon
            JMP +notPlayerWeapon
        +isWeapon

                LDX #$00
                loop_objectCollision:
                    CPX selfObject
                        BNE +notSelfObject
                            JMP +skipCollision
                        +notSelfObject
                LDA Object_status,x
                AND #%10000000
                BNE +isActive
                    JMP +skipCollision
                +isActive:
                LDA Object_flags,x
                AND #%00001000
                BNE isMonsterWeaponCol
                    JMP +notAmonsterWeaponCollision
                isMonsterWeaponCol:
                    JSR getOtherColBox
                    JSR doCompareBoundingBoxes
                        ;;; if they have collided, it is a 1
                        ;;; if not, it is a zero.
                        BEQ +skipCollision
                            TXA
                            STA otherObject
                            ;; There was a collision between a monster and a weapon.
                            ;; weapon is self.
                            ;; monster is other.
                            ;DestroyObject
                            ;ChangeActionStep otherObject, #$07
                           
                                JSR doHandleHurtMonster
                               
                            ;LDX selfObject
                            ;;DestroyObject
                            ;LDX otherObject
                            JMP +done              
                    +skipCollision
                +notAmonsterWeaponCollision
                INX
                CPX #TOTAL_MAX_OBJECTS
                BEQ +lastCollisionForThisObject
                    JMP loop_objectCollision
            +lastCollisionForThisObject
            JMP +done
           
           
        +notPlayerWeapon
           
            LDA Object_flags,x
            AND #%00000010
            BNE +isPlayerForCol
                ;; not player for collions
                    JMP +notPlayerForCollisions
            +isPlayerForCol
                ;;; check against monsters.
                    LDX #$00
                    loop_objectPlayerCollisions:
                        CPX selfObject
                        BNE +notSelfObject
                            JMP +skipCollision
                        +notSelfObject
                        LDA Object_status,x
                        AND #%10000000
                        BNE +isActive
                            JMP +skipCollision
                        +isActive
                        LDA Object_flags,x
                        AND #%00001000
                        BNE +isPlayerMonsterCol
                            JMP +notPlayerMonsterCollision
                        +isPlayerMonsterCol
                           
                            JSR getOtherColBox
                            JSR doCompareBoundingBoxes
                                ;;; if they have collided, it is a 1
                                ;;; if not, it is a zero.
                                BNE +dontSkipCol
                                    JMP +skipCollision
                                +dontSkipCol
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a monster and a weapon.
                                    ;; player is self.
                                    ;; monster is other.
                                    ;JMP RESET
                                   
                                        JSR doHandleHurtPlayer
                                   
                                    JMP +done
                                   
                        +notPlayerMonsterCollision:
                       
                            LDA Object_flags,x
                            AND #%00100000
                            BNE +isPlayerPowerupCol
                                JMP +isNotPlayerPowerupCol
                            +isPlayerPowerupCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BNE +doCollision
                                    JMP +skipCollision
                                +doCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    DestroyObject
                                    .include SCR_PICKUP_SCRIPTS
                                    JMP +done
                                   
                        +isNotPlayerPowerupCol  
                            LDA Object_flags,x
                            AND #%10000000
                            BNE +isPlayerNPCCol
                                JMP +isNotPlayerNPCCol
                            +isPlayerNPCCol
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BEQ +skipCollision
                                    TXA
                                    STA otherObject
                                    ;; There was a collision between a player and a powerup.
                                    ;; player is self.
                                    ;; powerup is other.
                                    TXA
                                    PHA
                                        LDX selfObject
                                        LDA xPrev
                                        STA Object_x_hi,x
                                        STA xHold_hi
                                       
                                        LDA yPrev
                                        STA Object_y_hi,x
                                        STA yHold_hi
                                       
                                        LDA #$00
                                        STA Object_h_speed_lo,x
                                        STA Object_h_speed_hi,x
                                        STA Object_v_speed_lo,x
                                        STA Object_v_speed_hi,x
                                        STA Object_x_lo,x
                                        STA Object_y_lo,x
                                    PLA
                                    TAX
                                    JMP +done
                                   
                            +isNotPlayerNPCCol
                           
                            +skipCollision
                   
                            INX
                            CPX #TOTAL_MAX_OBJECTS
                            BEQ +lastCollisionForThisObject
                                JMP loop_objectPlayerCollisions
                            +lastCollisionForThisObject
                            ; PLA
                            ; TAX
                            JMP +done
                       
                           
                            ;; Add other object to object collision types here.
                        JMP +done
                           
           
        +notPlayerForCollisions
   
+done  
    PLA
    TAY
    PLA
    TAX
+skipObjectCollisionCheck
    ReturnBank
It worked for me, now spider can die in just three hits as I wanted. :D SPECIAL THANK YOU!
 
Top Bottom