Monster lock almost working perfectly

baardbi

Well-known member
I have a tiny problem with the monster lock tile. I works exactly as it's supposed to, but when I go back to the screen where the monster lock was it's still there. I mean it's "triggered" in the sense that the solid collision has changed, but the graphics go back to the way it was when it was solid...

Here's a little video of the problem:

monsterlock.gif


Here is the code for KilledLastMonster_DC.asm:

Code:
	;; Remove all the monster locks:

	ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, #$00
	ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, #$01

Here's the code for Handle_CheckForMonsters_DC.asm:

Code:
;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;
	;; monster bit is: #%00001000 
;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;To change collision type and graphic
	CountObjects #%00001000, #$00 ;; count monsters.
	LDA monsterCounter
	CLC
	BEQ doNoMoreMonsterCode
	JMP stillMonstersOnScreen_onScreenload
doNoMoreMonsterCode
	
	;;; all of the tiles you would like to change when this screen is loaded.
	;;; do this routine for:
	;;; FIRST, GET RID OF LOCKS:
	LDA update_screen
	BNE screenIsOffForMonsterCheck
	JMP doScreenOnMonsterCheck
screenIsOffForMonsterCheck:
	
	;LDA showingNametable
	;STA temp
	;ChangeAllTilesDirect #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, temp
	JMP stillMonstersOnScreen_onScreenload
doScreenOnMonsterCheck:
	

	;;;;;===================
stillMonstersOnScreen_onScreenload:
;;;;  end what to do if no more objects

Here's the code for CheckTriggeredTilesLoad_DC.asm:

Code:
	LDA temp
	CMP #TILE_INDEX_LOCK
	BNE ++
	LDA #TILE_OPENDOOR ;; what tile do you want under lock?
	STA temp
	JMP notPath
++
	LDA temp
	CMP #TILE_MONSTER_LOCK
	BNE ++
	LDA #TILE_MONSTER_LOCK_OFF ;; what tile do you want under Monster Lock?
	STA temp
	JMP notPath
++
	LDA temp
	CMP #TILE_KEY
	BNE ++
	LDA #$00 ;; what tile do you want under Key?
	STA temp
	JMP notPath
++
 

dale_coop

Moderator
Staff member
You need to set correctly your constants:
"TILE_MONSTER_LOCK" the index (from your tileset) of the tile you use for your monster lock.
and
"TILE_MONSTER_LOCK_OFF" the index of the tile (from your tileset) used when the monsterLock is removed.
Those variables are used when a trigger screen graphics are loading... all the TILE_MONSTER_LOCK tiles are replaced by TILE_MONSTER_LOCK_OFF.

Here, more details http://www.nesmakers.com/viewtopic.php?p=22735#p22735
 

baardbi

Well-known member
Thank you so much Dale :) It works great! I can't tell you how grateful I am for all the help you have given me (and the community).
 
Top Bottom