Getting rid of used chests

SoulBlayzR

New member
Hey everyone, it's me again. So I'm trying to implement a chest system in my game, so that when you touch a chest, it plays a cutscene and adds to the item score.

I've done all that, but I now need help getting rid of the chest after the fact. I'm still a noob in ASM, not shy to admit that at all. It would be nice if I got some help with this.

The way this works is that the chest itself is a sprite. The actual magic happens with two "player victory" blocks behind it, which warp the player to another room. After it's all done, I want both the blocks and the sprite gone without a trace.

See here
[media]https://youtu.be/6HnvzQ4f080[/media]

Scripts I used:

Warp to Screen AI Action
Code:
LDA warpMap
adc #$00
STA temp
GoToScreen warpToScreen, temp, #$02

Open textbox AI Action
Code:
;; activate the text-box
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
 

dale_coop

Moderator
Staff member
If I understand well, your chest is a Game Object (or maybe a Monster Object)? And you have tiles that executes the player victory?
What type of tiles are they? What is the script assigned?

I think you could trigger the (current) screen when the player collects the chest...
You could try adding:
TriggerScreen screenType
To the script assigned to your tiles. It would get rid of your Chest object...but then, you will have to get rid of your tiles...
of maybe checking if the screen is triggered before executing the code.

Could you share the script assigned to those tiles?
 

SoulBlayzR

New member
Code:
    CPX player1_object
    BNE +
    TriggerScreen screenType
    CreateObject temp, temp1, #OBJ_PLAYER_VICTORY, #$00, currentNametable
    LDX player1_object
    DeactivateCurrentObject
    LDA #$01
    STA loadObjectFlag
    LDA #$ff  
+
 

dale_coop

Moderator
Staff member
This script should work... (getting rid of your Chest), right?
And if the tiles still execute the Victory, even after having triggered the screen, you could try this script (to prevent the code to execute):

Code:
    CPX player1_object
    BNE +
    
    GetTrigger	;; check if the screen is already triggered
    BNE +		;; if it IS triggered, we skip the code
    
    TriggerScreen screenType
    CreateObject temp, temp1, #OBJ_PLAYER_VICTORY, #$00, currentNametable
    LDX player1_object
    DeactivateCurrentObject
    LDA #$01
    STA loadObjectFlag
    LDA #$ff  
+
 

SoulBlayzR

New member
Line 2: branch out of range...

EDIT: Modified the script to get rid of the branch out of range error:
Code:
    CPX player1_object
    BNE EndScript1
    
    GetTrigger  ;; check if the screen is already triggered
    BNE EndScript1       ;; if it IS triggered, we skip the code
    
    TriggerScreen screenType
    JMP ScriptPart2
    
EndScript1:
    JMP EndScript2
    
ScriptPart2:    
    CreateObject temp, temp1, #OBJ_PLAYER_VICTORY, #$00, currentNametable
    LDX player1_object
    DeactivateCurrentObject
    LDA #$01
    STA loadObjectFlag
    LDA #$ff  

EndScript2:

Thanks for the help!
 
Top Bottom