Ok, I'm trying to backwards recreate how I did to get the walkBehind-Tile to work.
I am using it in my metroidvania game (4.5.9) and it works well.
It looks like this is what i did:
WalkBehindTile -Tutorial 2024
First you need a tile script
Code:
;;WalkBehind tile
LDA Object_flags,x
ORA #%01000000
STA Object_flags,x
RTS
Then lets go to ProjectSettings - Subroutines
we need to edit Handle Drawing Sprites
Look for this part, my scripts is further modyfied can't say exactly what line.
Code:
doDrawSpritesLoop:
LDA (temp16),y
clc
ADC temp3
STA tempC ;; the calculated table position, with offest.
;; tempC becomes the "tile to draw".
INY
LDA Object_flags,x ;WalkBehind
AND #%01000000 ;WalkBehind
BNE +noPriFlip ;WalkBehind
LDA (temp16),y ;WalkBehind
JMP +doneFlip ;WalkBehind
+noPriFlip ;WalkBehind
LDA (temp16),y
ORA #%00100000 ;WalkBehind
+doneFlip ;WalkBehind
STA tempD ;; the next value is the attribute to draw.
INY ;; increasing again sets us up for the next sprite.
;; now we can use tempA-D to draw our sprite using the macro.
And finally go to ProjectSettings - Subroutines - Handle Tile Collisions
Look for this part of the code:
I commented with "baardbi" on the lines that needs changing.
Code:
LDA tempA
BEQ +skipThisTile
CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid
+skipThisTile
LDA tempB
BNE +dontSkipThisTile
JMP +skipThisTile
+dontSkipThisTile:
CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid
+skipThisTile
LDA tempC
BEQ +skipThisTile
CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid
+skipThisTile
LDA tempD
BEQ +skipThisTile
CMP #$01
;BEQ +isSolid ;baardbi fix for walkbehind tile
BNE +skipThisTile ;baardbi
JMP +isSolid ;baardbi
+skipThisTile
LDA Object_flags,x ;baardbi
AND #%10111111 ;baardbi
STA Object_flags,x ;; reset sprite priority ;baardbi
LDA tempA
BEQ tempAisNull
;; temp A is not null
Now everyting should hopfully be working..
All credit goes to AllDarnDavey, baardbi and everyone else who has helped create this!!!
I just copied and pasted it together.
This is one of my favorite tutorial fixes, really makes your game look cooler.