[4.1] Adding Monster Locks for your game (Basic core)

User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Lock in the Platformer module

Post by dale_coop » Sun Jan 13, 2019 10:43 pm

Check my tutorials on page 1... it's all updated, with the EASY way to install/update all this!
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Sun Jan 13, 2019 11:11 pm

At first effort, I'm getting this compiler error.

Routines\Basic\ModuleScripts\MainScripts\AdventureGame\Handle_CheckForMonsters.asm(13): Label already defined.
Routines\Basic\ModuleScripts\MainScripts\AdventureGame\Handle_CheckForMonsters.asm(21): Label already defined.
Routines\Basic\ModuleScripts\MainScripts\AdventureGame\Handle_CheckForMonsters.asm(27): Label already defined.
Routines\Basic\ModuleScripts\MainScripts\AdventureGame\Handle_CheckForMonsters.asm(31): Label already defined.
demo.txt written.
User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Sun Jan 13, 2019 11:18 pm

Could you share your script?
And a screenshot of your "Project Settings > Script settings"?

Looks like this code already somewhere (or duplicate) in your project.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Sun Jan 13, 2019 11:23 pm

Ok no sorry... my mistake (might be too late for me now)... sorry, man ;)


Here your "Handle_CheckForTriggers":

Code: Select all

;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;



		LDA screenType
		;; divide by 32
		LSR
		LSR
		LSR 
		;LSR
		;LSR
		;;; now we have the right *byte* out of the 32 needed for 256 screen bytes
		TAY
		LDA screenTriggers,y ;; now the rigth bit is loaded into the accum
		STA temp
		LDA screenType
		AND #%00000111 ;; look at last bits to know what bit to check, 0-7
		TAX
		LDA ValToBitTable_inverse,x
		AND temp
		BNE +
		JMP thisScreenIsNotTriggered_onScreenLoad
	+
		;; this screen IS triggered
DoDestroyAllTriggerTiles:	
	;;; HERE:
	;;; all of the tiles you would like to change when this screen is loaded.
	;;; do this routine for:
	;;; FIRST, GET RID OF LOCKS:
	LDA showingNametable
	STA temp
	ChangeAllTilesDirect #COL_LOCK, #$00, #TILE_OPENDOOR, temp
	;;; NOW, GET RID OF KEY TILES:
	LDA showingNametable
	STA temp
	ChangeAllTilesDirect #COL_KEY, #$00, #$00, temp ;; arg2 = floor, null, etc
	;ChangeAllTiles #COL_KEY, #$00, #$00, temp
	

thisScreenIsNotTriggered_onScreenLoad:

And here your "Handle_CheckForMonsters":

Code: Select all

;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;
	;; 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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 12:18 am

Okay. No more error, but...you guessed it, my lock blocks are still staying on the screen when I reenter a room.

I am using a tile that is assigned as a "4- Locked Door." This is the tile that is the issue.

Also, I want my screens to trigger and stay triggered. So where exactly do I re-add the TriggerScreen screentype line to make that happen?
Attachments
Screenshot (80).png
Screenshot (80).png (329.92 KiB) Viewed 506 times
User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 7:25 am

Check script assigned to the "Killed Last Monster", it should looks like

Code: Select all

	;; Remove all the monster locks:
	LDA showingNametable
	STA temp
	ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, temp
If you REALLY want to trigger it should be:

Code: Select all

	;; Trigger the current screen:
	TriggerScreen screenType
	
	;; Remove all the monster locks:
	LDA showingNametable
	STA temp
	ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, temp
That means if you kill all the monsters your screen will be triggered.
When you (re) enter into a triggered screen, your normal monsters will not be there, so your monster tiles will be removed (of course) AND your doors will be removed too (even you didn't unlock them with the key. Keep that in mind).
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 4:03 pm

With this code implemented, not only do the lock block tiles remain when re-entering a screen, but now so do the monster locks. :(
User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 4:20 pm

And what about the monsters? Are they back?
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 5:30 pm

No, the monsters stay gone.

What's weird is that the monster lock tile graphic for one room stays gone but for other rooms in the dungeon, they come back. So confused...
User avatar
dale_coop
Posts: 3596
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 6:29 pm

How is your HUD? You still have it on every screens? Could you share screenshots?
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
Post Reply