I think I fixed the Monster Lock Tiles to make it work for all the screens (not only the odd number screens
)
1/ You don't have them already, add a new "TILE_OPENDOOR" user constants with a value "0".
And a new "TILE_MONSTER_LOCK" user constants (in the "Project Settings > User Constants" with the value of YOUR monster tile (for this exemple, the numeric value is "70"):
To find the value, just look at your tile infos :
Here, it's a tileID #$46 (in hexa), it means 70 in numeric.
You can also check directly in your tileset, counting from 0 to 255 (from top to bottom, left to right) :
2/ Make a new script "CheckTriggeredTileLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with this code:
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
++
3/ Make a new script "CheckTriggeredColLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with:
Code:
LDA temp
CMP #COL_INDEX_LOCK
BNE ++
;;; if it was a locked tile, make sure it is
LDA #$00
STA temp ;; set it to a walkable tile.
++
LDA temp
CMP #COL_MONSTER_LOCK
BNE ++
;;; if it was a monster locked tile, make sure it is
LDA #$00
STA temp ;; set it to a walkable tile.
++
3/ Modify the content of the "LoadCollisionBytes.asm" script in the "GameEngineData\Routines\Basic\System", with this code (make a copy before, to keep the original one):
Code:
LoadCollisionBytes:
JSR LoadEvenCollisionPoint
INX
DEC updateCol_columnCounter
notEndOfColumn:
JSR LoadOddCollisionPoint
INX
DEC updateCol_columnCounter
LDA updateCol_columnCounter
BNE notEndOfColumn2
;; is end of column.
LDA updateCol_columns
STA updateCol_columnCounter
TXA
SEC
SBC updateCol_columns
CLC
ADC #$10
TAX
LDA updateCol_columns
LSR
STA temp2
TYA
SEC
SBC temp2
CLC
ADC #$08;; one more will get added below as part of flowing into notEndofColumn2
TAY
INC updateCol_rowCounter
LDA updateCol_rowCounter
CMP updateCol_rows
BEQ doneWithColBytes
notEndOfColumn2:
INY
;CPY #$78
;BEQ doneWithColBytes
JMP LoadCollisionBytes
doneWithColBytes
RTS
doEndOfColumn:
INC updateCol_rowCounter
LDA updateCol_columns
STA updateCol_columnCounter
RTS
LoadEvenCollisionPoint:
;; get the first point:
LDA (collisionPointer),y
LSR
LSR
LSR
LSR
STA temp
;;;;;;;;;;;; CHECK FOR TRIGGERED.
;;;;;;;;;;;; Do all triggered updates here.
GetTrigger
BEQ noTriggerStateEvenCollisionPoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ALL POSSIBLE "CHANGE COLLISIONS", make the caveat here:
.include SCR_TRIGGERED_COL_LOADS
noTriggerStateEvenCollisionPoint:
;;; this is the first point.
LDA updateCol_table
BNE loadFirstPoint_ToSecondNametable
LDA temp
STA collisionTable,x ;; the collision table in RAM
LDA newScreen
AND #%00000001
BNE loaded_FirstPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
JMP loaded_FirstPoint
loadFirstPoint_ToSecondNametable:
LDA temp
STA collisionTable2,x
LDA newScreen
AND #%00000001
BEQ loaded_FirstPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
loaded_FirstPoint:
RTS
LoadOddCollisionPoint:
LDA (collisionPointer),y
AND #%00001111
sta temp
GetTrigger
BEQ noTriggerStateOddCollisionPoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ALL POSSIBLE "CHANGE COLLISIONS", make the caveat here:
.include SCR_TRIGGERED_COL_LOADS
noTriggerStateOddCollisionPoint:
LDA updateCol_table
BNE update_CollisionTable2_2
LDA temp
STA collisionTable,x
LDA newScreen
AND #%00000001
BNE loaded_SecondPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
JMP loaded_SecondPoint
update_CollisionTable2_2:
LDA temp
STA collisionTable2,x
LDA newScreen
AND #%00000001
BEQ loaded_SecondPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
loaded_SecondPoint:
RTS
4/ In the "Project Settings > Script Settings", add a new script element (button "Add") , named it "Handle Triggered Collisions" with the code "SCR_TRIGGERED_COL_LOADS"
And assign it the script "Routines\Basic\System\CheckTriggeredColLoads_DC.asm".
5/ And, assign the script "In the "Routines\Basic\System\CheckTriggeredTileLoads_DC.asm" to the "Handle Triggered Tiles" element.
6/ Modify the "KilledLastMonster_DC.asm" script in the "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\AdventureGame" folder (or in "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatform" if Scrolling Plaformer, ...), replacing with this code:
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
Check this script is assigned to the "Kill Last Monster" element:
Note: I will update my tutorial and the ZipScripts during the afternoon.