Craigery
Active member
I am trying to have my player snap to a tile when you press down and change action step, but if you are moving left/right when you snap you will continue to move even after snapping and the action step change. Here is my tile code:
I have this near the end, I was hoping that would cancel out the momentum, but that doesn't appear so. Does anyone have any experience with this or have any ideas?
Code:
;;playerShadowVarCheck
LDA playerShadow ;;Variable is named playerShadow
CMP #$00 ;;compares against 0
BEQ gamepadShadowCheck ;;If it is 0, go to gamepadShadowCheck
JMP endShadowTileAttempt ;;If it is NOT 0, then go to end.
GetActionStep player1_object
CMP #$04
BEQ +endShadowTileAttempt
gamepadShadowCheck:
LDA gamepad ;;Loads gamepad
AND #%0100000 ;;checks if Down is pressed
BNE startShadowTileAttempt ;;if so then go to startShadowTileAttempt
JMP endShadowTileAttempt ;;jump to endShadowTileAttempt
startShadowTileAttempt:
; PlaySound #sfx_Shadow
LDA tileX
AND #%11110000
STA Object_x_hi,x
STA xHold_hi
LDA tileY
AND #%11110000
SBC #$01
STA Object_y_lo,y
STA yHold_hi
LDA #$00
STA Object_v_speed_lo,x
LDA #$00
STA Object_v_speed_hi,x
LDA #$01
STA playerShadow
ChangeActionStep player1_object, #$04
endShadowTileAttempt:
I have this near the end, I was hoping that would cancel out the momentum, but that doesn't appear so. Does anyone have any experience with this or have any ideas?
Code:
LDA #$00
STA Object_v_speed_lo,x
LDA #$00
STA Object_v_speed_hi,x