Background corruption after player death [4.5.9 shooter]

Zikifer

Member
After my player dies and is warped back to the continue point, there are graphical glitches with the background. They are always in the same place and seem to affect a column.

game_000.png
(That block under the S shouldn't be there, and the shore above and below should be light brown+green, not blue.)

I am using Checkpoint tiles to save the player position periodically. The player starts right in front of one so I'm guaranteed that the values have been initialized properly. That code is
Code:
;;; Checkpoint tile
LDA updateScreenData
AND #%00000100
BEQ +doScript
    ;; wait until tile update is finished.
    RTS

+doScript:   
    CPX player1_object
    BEQ +doCheckpoint
        JMP +skip

+doCheckpoint:
    LDA warpMap
    STA continueMap

    LDA Object_screen,x
    STA continueScreen
    
    LDA Object_x_hi,x
    STA continueX
    
    LDA Object_y_hi,x
    STA continueY
    
    ChangeTileAtCollision #0, #0 ;; change to tile zero (make disappear), collision type 0
    JSR doWaitFrame

+skip:
    RTS

On player death it changes to Action Step 7 and plays a death animation, with Action "StopMoving" and End Animation "Go To Continue". The "Go To Continue" code:
Code:
;;; 09 = Go To Continue
goToContinue_action:
    LDA continueMap
    STA warpToMap
    
    LDA continueScreen
    STA warpToScreen

    WarpToScreen warpToMap, warpToScreen, #$02
    RTS

I have already removed all of the Path code (per instructions on this forum) and it didn't seem to make a difference. Any suggestions?
 

dale_coop

Moderator
Staff member
My first suggestion is... if your checkpoint tile is invisible, just comment out the ChangeTileAtCollision line, you don't need that and in fact it can cause a glitch when your player respawn on it.

Alson about glitches after warps, where is that very useful topic:
 

Zikifer

Member
Thanks! I think this part fixed it:
Code:
LDA #%11000010
STA scrollByte

Making my Go To Continue action:
Code:
goToContinue_action:
    LDA #%11000010
    STA scrollByte

    WarpToScreen continueMap, continueScreen, #$02
    JSR doWaitFrame
    RTS
 
Top Bottom