update minecart directional logic
This commit is contained in:
@@ -455,10 +455,6 @@ Sprite_Minecart_Main:
|
|||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
|
|
||||||
North = $00
|
|
||||||
East = $01
|
|
||||||
South = $02
|
|
||||||
West = $03
|
|
||||||
|
|
||||||
HandleTileDirections:
|
HandleTileDirections:
|
||||||
{
|
{
|
||||||
@@ -516,13 +512,13 @@ HandleTileDirections:
|
|||||||
.stop_east
|
.stop_east
|
||||||
; Set the new direction to east and flip the cart's orientation
|
; Set the new direction to east and flip the cart's orientation
|
||||||
LDA.b #West : STA SprSubtype, X : STA.w !MinecartDirection
|
LDA.b #West : STA SprSubtype, X : STA.w !MinecartDirection
|
||||||
LDA #$03 : STA !SpriteDirection, X
|
LDA #$02 : STA !SpriteDirection, X
|
||||||
JMP .go_horiz
|
JMP .go_horiz
|
||||||
|
|
||||||
.stop_west
|
.stop_west
|
||||||
; Set the new direction to west and flip the cart's orientation
|
; Set the new direction to west and flip the cart's orientation
|
||||||
LDA.b #East : STA SprSubtype, X : STA.w !MinecartDirection
|
LDA.b #East : STA SprSubtype, X : STA.w !MinecartDirection
|
||||||
LDA #$02 : STA !SpriteDirection, X
|
LDA #$03 : STA !SpriteDirection, X
|
||||||
|
|
||||||
; -----------------------------------------------
|
; -----------------------------------------------
|
||||||
.go_horiz
|
.go_horiz
|
||||||
@@ -546,9 +542,11 @@ HandleTileDirections:
|
|||||||
; Are we moving left or right?
|
; Are we moving left or right?
|
||||||
LDA SprSubtype, X : CMP.b #$03 : BEQ .inverse_horiz_velocity
|
LDA SprSubtype, X : CMP.b #$03 : BEQ .inverse_horiz_velocity
|
||||||
LDA.b #!MinecartSpeed : STA SprXSpeed, X
|
LDA.b #!MinecartSpeed : STA SprXSpeed, X
|
||||||
|
LDA.b #East : STA !MinecartDirection
|
||||||
JMP .done
|
JMP .done
|
||||||
.inverse_horiz_velocity
|
.inverse_horiz_velocity
|
||||||
LDA.b #-!MinecartSpeed : STA SprXSpeed, X
|
LDA.b #-!MinecartSpeed : STA SprXSpeed, X
|
||||||
|
LDA.b #West : STA !MinecartDirection
|
||||||
JMP .done
|
JMP .done
|
||||||
.vert
|
.vert
|
||||||
; Are we moving up or down?
|
; Are we moving up or down?
|
||||||
@@ -661,31 +659,35 @@ HandleDynamicSwitchTileDirections:
|
|||||||
.east_or_west
|
.east_or_west
|
||||||
LDA SwitchRam : BNE .go_west
|
LDA SwitchRam : BNE .go_west
|
||||||
LDA #$01 : STA SprSubtype, X
|
LDA #$01 : STA SprSubtype, X
|
||||||
|
STA.w !MinecartDirection
|
||||||
LDA #$03 : STA !SpriteDirection, X
|
LDA #$03 : STA !SpriteDirection, X
|
||||||
%GotoAction(3) ; Minecart_MoveEast
|
%GotoAction(3) ; Minecart_MoveEast
|
||||||
LDA SprY, X : AND #$F8 : STA SprY, X
|
; LDA SprY, X : AND #$F8 : STA SprY, X
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.go_west
|
.go_west
|
||||||
LDA #$03 : STA SprSubtype, X
|
LDA #$03 : STA SprSubtype, X
|
||||||
|
STA.w !MinecartDirection
|
||||||
LDA #$02 : STA !SpriteDirection, X
|
LDA #$02 : STA !SpriteDirection, X
|
||||||
%GotoAction(5) ; Minecart_MoveWest
|
%GotoAction(5) ; Minecart_MoveWest
|
||||||
LDA SprY, X : AND #$F8 : STA SprY, X
|
; LDA SprY, X : AND #$F8 : STA SprY, X
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.north_or_south
|
.north_or_south
|
||||||
LDA SwitchRam : BEQ .go_south
|
LDA SwitchRam : BNE .go_south
|
||||||
LDA #$00 : STA SprSubtype, X
|
LDA #$00 : STA SprSubtype, X
|
||||||
|
STA.w !MinecartDirection
|
||||||
STA !SpriteDirection, X
|
STA !SpriteDirection, X
|
||||||
%GotoAction(2) ; Minecart_MoveNorth
|
%GotoAction(2) ; Minecart_MoveNorth
|
||||||
LDA SprX, X : AND #$F8 : STA SprX, X
|
; LDA SprX, X : AND #$F8 : STA SprX, X
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.go_south
|
.go_south
|
||||||
LDA #$02 : STA SprSubtype, X
|
LDA #$02 : STA SprSubtype, X
|
||||||
|
STA.w !MinecartDirection
|
||||||
LDA #$01 : STA !SpriteDirection, X
|
LDA #$01 : STA !SpriteDirection, X
|
||||||
%GotoAction(4) ; Minecart_MoveSouth
|
%GotoAction(4) ; Minecart_MoveSouth
|
||||||
LDA SprX, X : AND #$F8 : STA SprX, X
|
; LDA SprX, X : AND #$F8 : STA SprX, X
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
@@ -740,6 +742,8 @@ CheckForPlayerInput:
|
|||||||
LDY !SpriteDirection, X
|
LDY !SpriteDirection, X
|
||||||
LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up
|
LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up
|
||||||
LDA.b #$00 : STA !SpriteDirection, X ; Moving Up
|
LDA.b #$00 : STA !SpriteDirection, X ; Moving Up
|
||||||
|
|
||||||
|
LDA.b #North : STA !MinecartDirection
|
||||||
STA SprSubtype, X
|
STA SprSubtype, X
|
||||||
%GotoAction(2) ; Minecart_MoveNorth
|
%GotoAction(2) ; Minecart_MoveNorth
|
||||||
BRA .return
|
BRA .return
|
||||||
@@ -747,20 +751,26 @@ CheckForPlayerInput:
|
|||||||
.not_pressing_up:
|
.not_pressing_up:
|
||||||
LDA $00 : AND.b #$04 : BEQ .not_pressing_down
|
LDA $00 : AND.b #$04 : BEQ .not_pressing_down
|
||||||
LDA.b #$01 : STA !SpriteDirection, X
|
LDA.b #$01 : STA !SpriteDirection, X
|
||||||
LDA #$02 : STA SprSubtype, X
|
|
||||||
|
LDA.b #South : STA !MinecartDirection
|
||||||
|
STA SprSubtype, X
|
||||||
%GotoAction(4) ; Minecart_MoveSouth
|
%GotoAction(4) ; Minecart_MoveSouth
|
||||||
BRA .return
|
BRA .return
|
||||||
|
|
||||||
.not_pressing_down
|
.not_pressing_down
|
||||||
LDA $00 : AND.b #$02 : BEQ .not_pressing_left
|
LDA $00 : AND.b #$02 : BEQ .not_pressing_left
|
||||||
LDA.b #$02 : STA !SpriteDirection, X
|
LDA.b #$02 : STA !SpriteDirection, X
|
||||||
LDA #$03 : STA SprSubtype, X
|
|
||||||
|
LDA.b #West : STA !MinecartDirection
|
||||||
|
STA SprSubtype, X
|
||||||
%GotoAction(5) ; Minecart_MoveWest
|
%GotoAction(5) ; Minecart_MoveWest
|
||||||
BRA .return
|
BRA .return
|
||||||
|
|
||||||
.not_pressing_left
|
.not_pressing_left
|
||||||
LDA $00 : AND.b #$01 : BEQ .always
|
LDA $00 : AND.b #$01 : BEQ .always
|
||||||
LDA.b #$03 : STA !SpriteDirection, X
|
LDA.b #$03 : STA !SpriteDirection, X
|
||||||
|
|
||||||
|
LDA.b #East : STA !MinecartDirection
|
||||||
STA SprSubtype, X
|
STA SprSubtype, X
|
||||||
%GotoAction(3) ; Minecart_MoveEast
|
%GotoAction(3) ; Minecart_MoveEast
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user