Sudden crash [MazeBase 4.5.9]

BITVADER

Member
Is it possible to change the way of thinking, for example, check myLives after restart (TimerEndScripts.asm) and execute action step 06 if it is 0?
 

dale_coop

Moderator
Staff member
I tested with that script (for the handle player hurt), and it seems to work correctly:
Code:
    TXA
    PHA

    LDA gameState
    BEQ +continue
        JMP +skipHurt
    +continue:
    

    LDA gameHandler
    AND #%10000000
    BEQ +canHurtPlayer
        JMP +skipHurt
        +canHurtPlayer:
    TXA
    STA temp
    GetActionStep temp
    CMP #$07
    BNE +canHurtPlayer
        JMP +skipHurt
    +canHurtPlayer
    GetActionStep temp
    CMP #$06
    BNE +PsHurt
        JMP +skipHurt
    +PsHurt
    DEC myLives
    
    PlaySong #song_index_MISSBGM
    UpdateHudElement #$01
    LDA myLives
    BNE +notZeroLives
    ;;;zero lives
        ChangeActionStep player1_object, #$06       
    ;; recoil
            LDA #$00
            STA Object_h_speed_hi,x
            STA Object_h_speed_lo,x
            STA Object_v_speed_hi,x
            STA Object_v_speed_lo,x
            ; LDA xPrev
            ; STA Object_x_hi,x
            ; LDA yPrev
            ; STA Object_y_hi,x
            StopMoving temp, #$FF, #$00   
            ;;WarpToScreen warpToMap, #$47, #$01   
        ;;JMP RESET
        ;;RTS
        LDA #$FF
        STA gameState
        JMP +skipHurt
        
    +notZeroLives

    ChangeActionStep player1_object, #$07
            ;; recoil
            LDA #$00
            STA Object_h_speed_hi,x
            STA Object_h_speed_lo,x
            STA Object_v_speed_hi,x
            STA Object_v_speed_lo,x
            ; LDA xPrev
            ; STA Object_x_hi,x
            ; LDA yPrev
            ; STA Object_y_hi,x
            StopMoving temp, #$FF, #$00   

    
+skipHurt
    PLA
    TAX
 

BITVADER

Member
It seems that the jump process (JMP + skipPurt) is ignored during action step # 07 and the monster is hit and double (DEC myLives) is executed only when myLives goes from 1 to 0 remaining.
View: https://youtu.be/PxdFY2Wnchs

It's hard to understand in a moment, but myLives is behaving abnormally like underflow.
 

Holmfry

Member
I tested with that script (for the handle player hurt), and it seems to work correctly:
Code:
    TXA
    PHA

    LDA gameState
    BEQ +continue
        JMP +skipHurt
    +continue:
   

    LDA gameHandler
    AND #%10000000
    BEQ +canHurtPlayer
        JMP +skipHurt
        +canHurtPlayer:
    TXA
    STA temp
    GetActionStep temp
    CMP #$07
    BNE +canHurtPlayer
        JMP +skipHurt
    +canHurtPlayer
    GetActionStep temp
    CMP #$06
    BNE +PsHurt
        JMP +skipHurt
    +PsHurt
    DEC myLives
   
    PlaySong #song_index_MISSBGM
    UpdateHudElement #$01
    LDA myLives
    BNE +notZeroLives
    ;;;zero lives
        ChangeActionStep player1_object, #$06      
    ;; recoil
            LDA #$00
            STA Object_h_speed_hi,x
            STA Object_h_speed_lo,x
            STA Object_v_speed_hi,x
            STA Object_v_speed_lo,x
            ; LDA xPrev
            ; STA Object_x_hi,x
            ; LDA yPrev
            ; STA Object_y_hi,x
            StopMoving temp, #$FF, #$00  
            ;;WarpToScreen warpToMap, #$47, #$01  
        ;;JMP RESET
        ;;RTS
        LDA #$FF
        STA gameState
        JMP +skipHurt
       
    +notZeroLives

    ChangeActionStep player1_object, #$07
            ;; recoil
            LDA #$00
            STA Object_h_speed_hi,x
            STA Object_h_speed_lo,x
            STA Object_v_speed_hi,x
            STA Object_v_speed_lo,x
            ; LDA xPrev
            ; STA Object_x_hi,x
            ; LDA yPrev
            ; STA Object_y_hi,x
            StopMoving temp, #$FF, #$00  

   
+skipHurt
    PLA
    TAX
YOU ARE MY HERO!! That worked!! OMG thank you so much!! That approach makes perfect sense. :)

Also I noticed in your signature your son made Kubo 3! I played through that on my Evercade and really enjoyed it :) Pretty cool I have some of your code in my game now ;)
 

dale_coop

Moderator
Staff member
Glad the script worked for you, @Holmfry
Thank you, yes, KUBO 3 is my son's game, I helped him for the code (like I did for some other nesmaker projects).
 

dale_coop

Moderator
Staff member
@BITVADER the last script I shared should have worked...
if you want, I can take a look at your project? (I'd need the .MST project file and a copy of your "GraphicAssets" and "GameEngineData" folders... we can continue via PM)
 

Holmfry

Member
Glad the script worked for you, @Holmfry
Thank you, yes, KUBO 3 is my son's game, I helped him for the code (like I did for some other nesmaker projects).
That's so cool! Your son must've been on cloud 9 when that released!! Amazing parenting :) I have a couple of my kids smaller projects on my site but nothing that got printed to cartridge like that!

Also I just released the demo of the game I'm working on if you're interested - https://holmadegames.itch.io/bustina. Would love any feedback.
 
Top Bottom