DarthAT
Member
I am trying to make a warp tile that warps the player to the next screen, either UP, Down, Left, or Right based on the tile type. Goal is to move sprite from room to room using a "door" drawn on background wall, and not just moving up to next screen (that looks funny with my background).
I have been playing with code on how to do this but it no matter what I change it warps me to the lower right corner of underworld x=1, y=3. Can I please get some help with this code? I do want to warp to the underworld so that part is working, but I want it to warp me to X=2, Y=4
I have been playing with code on how to do this but it no matter what I change it warps me to the lower right corner of underworld x=1, y=3. Can I please get some help with this code? I do want to warp to the underworld so that part is working, but I want it to warp me to X=2, Y=4
Code:
;;CPX player1_object
;;BNE +notPlayerForWarpTile
;WarpToScreen 0, #%00111111, #$02
;; arg0 = warp to map. 0= map1. 1= map2.
;; arg1 = screen to warp to.
;; arg2 = screen transition type - most likely use 1 here.
;; 1 = warp, where it observes the warp in position for the player.
LDA 0
STA warpMap
+doActivateScrollByte:
RIGHT_SCROLL_PAD = #$60
LDX player1_object
LDA Object_x_hi,x
SEC
SBC camX
CMP #RIGHT_SCROLL_PAD
BEQ +doActivateScrollByte
BCS +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS
+doActivateScrollByte
LDA scrollByte
AND #%01101000 ;;#%01000000
BNE +notChangingCamDirectionForUpdate
LDA scrollByte
ORA #%11011010 ;;#%00000010
+notChangingCamDirectionForUpdate
AND #%11100101 ;;#%00111111
ORA #%00010110 ;;#%11000000
STA scrollByte
;;; just like movement byte of a player.
;;; bit 7 indicates horizontal movement of a player
;;; bit 6 indicates 0 for left, 1 for right.
LDA #$01
STA screenTransitionType ;; is of warp type
LDA updateScreenData
AND #%11111011
STA updateScreenData
LDA scrollByte
AND #%11111110
STA scrollByte
LDA #$00
STA scrollOffsetCounter
LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
+notPlayerForWarpTile: