Creating Action Step Flag for Jump On Kills Script (4.5.6)

twin paradox

New member
I am trying to create an action step flag that will toggle the jumponkills behavior on and off. Basically I want to be able to kill certain monsters by jumping on them and have other monsters that can't be jumped on at all (hurts the player). I have modified the playerhurtscript because that is the script that contains the jumponkills code. Basically I check to see if action step 4 is flipped and if so, I skip the entire portion of code that contains the jumponkill code and have the player get hurt as if they walked into the side of the monster. For some reason, the jumponkills portion of the code gets run every time, regardless of whether I have the flag checked or not under "Object Details". Please let me know if you guys see any error in my logic. The code is below:

Code:
    ;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
    ;;;;;;;;;;;;;;;;;; You could also create your own variable for this.

    LDA gameHandler
    AND #%10000000
    BEQ +canHurtPlayer
    JMP +skipHurt
    +canHurtPlayer:
  
   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;                        

    LDA Object_vulnerability,x
    AND #%00001000
    BEQ +dojumponkill
    ;;; What should we do if vulnerability bit 3 is flipped?
    JMP +doHurtPlayer  
                            
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    
	+dojumponkill
    ;;;jumponkill script below
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;; is the monster below our feet?
    ;;;;;;;;;; and are we moving downward?
    LDA Object_v_speed_hi,x
    BEQ +doHurtPlayer ;; equal to zero
    BMI +doHurtPlayer ;; or negative
     ;; here we are moving downward.
     
    TXA
    PHA
    LDX otherObject
    DestroyObject
    PLA
    TAX

    ;; Do a hop
    LDA #$FB
    STA Object_v_speed_hi,x
     

     JMP +skipHurt

    
+doHurtPlayer  

    Dec myLives
    LDA myLives
    BNE myLivesNotZero
        JMP RESET ;; game over.
        ;;;; also could warp to game over screen here instead.
myLivesNotZero:

    LDA continueMap
    STA warpMap
    
    LDA continueScreen
    STA currentNametable
    AND #%00001111
    STA camX_hi
    
    LDX player1_object
    STA Object_screen,x
    
    LDA #$02 ;; this is continue type warp.
    STA screenTransitionType ;; is of warp type

    
    LDA #$00
    STA camX
    
    LDA gameHandler
    ORA #%10000000
    STA gameHandler ;; this will set the next game loop to update the screen.

+skipHurt
 

twin paradox

New member
Pauldalyjr said:
I don't see where you are comparing to action step 4 in this code.

This part of the code right here:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

LDA Object_vulnerability,x
AND #%00001000
BEQ +dojumponkill
;;; What should we do if vulnerability bit 3 is flipped?
JMP +doHurtPlayer

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I was under the assumption that Object_vulnerability could be used to check if an action step flag had been set or not by "AND-ING" with a certain bit set to 1. I used similar blocks of code in the HandleObjectCollisions script to create action step flags for ignoring player/monster collision etc and they worked as planned.
 
Top Bottom