Keep item from respawning while backtracking

Wattshout

New member
Hi, I'm new to NesMaker and maybe I missed something in the tutorials. But is there a way to keep items that have been picked up from respawning once you leave the screen then come back?

I want ot make a game where you have the freedom to explore while collecting treasures to get a high-score (and maybe extra lives). But I don't want the player to be able to boost his score just by picking up an easy to reach item over and over beacause he leaves the screen and come back.
 
I have a similar issue i created a treasure box pick up using the key pick up but changing to add $10 to score, but when I leave screen and come back in the treasure chests respawn. For some reason collecting the chests doesn't trigger the screen so they come back on re-entry to room.

Code:
;; COLLECTABLE - this tile requires 
;; HUD to be active and for myScore variable to be drawn.
;; To use this without this feature, comment out lines marked below.
	CPX player1_object
	BEQ isPlayerForCollectableMoney
	JMP ++
isPlayerForCollectableMoney:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; TO USE WITHOUT HUD, COMMENT OUT THIS BLOCK
;;; It may result in anomalies if two tiles
;;; register collision simultaneously without
;;; this block.
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	
	AddValue #$08, myMoney, #$0A, #$00
	;;; we also need to set up the routine to update the HUD
	;; for this to work right, health must be a "blank-then-draw" type element.
	;STA hudElementTilesToLoad
	;	LDA #$00
	;	STA hudElementTilesMax
		; LDA DrawHudBytes
		; ora #HUD_myMoney
		; STA DrawHudBytes
		
	UpdateHud HUD_myMoney
	
	LDX tempx
	PlaySound #SND_GET_COIN
	LDA #$00
	STA value
	STA value+1
	STA value+2
	STA value+3
	STA value+4
	STA value+5
	STA value+6
	STA value+7
	
	TriggerScreen screenType
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


++
 

dale_coop

Moderator
Staff member
Because "special" tiles are all removed on triggered screens (objects-> YES... key tiles->YES... monster lock tiles -> YES).
Have you followed my "monster lock" tutorial? If you did, you could just modify 2 scripts to make your chest work (disappear)
 
dale_coop said:
Because "special" tiles are all removed on triggered screens (objects-> YES... key tiles->YES... monster lock tiles -> YES).
Have you followed my "monster lock" tutorial? If you did, you could just modify 2 scripts to make your chest work (disappear)

I have not followed your "Monster Lock" Tutorial yet, but will be looking into it. Will also see if i can use a collectible object instead of tile. See which works best for me.
 

dale_coop

Moderator
Staff member
Nice.
If you use a pickup object instead, you should not have this issue, after having triggered the screen, yeah.
 
Top Bottom