I am having trouble determining the player's facing direction however.
Here is what I have so far:
Code: Select all
;; MODIFIED FROM DEFAULT JUMP SCRIPT
;; Get player object
;; Check if in air, and skip if so.
LDX player1_object
LDA Object_status,x
AND #%00000100
BEQ +
;; Check facing direction
LDA Object_movement,x
AND #%00000111 ;only keep the last 3 bits
CMP #$00000110 ;facing right
BEQ slideRight
JMP slideLeft
slideRight:
;FACE_RIGHT = #%00000010
LDA #$00
SEC
ADC #$03
STA Object_h_speed_hi,x
slideLeft:
;FACE_LEFT = #%00000110
;; Store 250 in accumulator and assign it to object's speed
LDA #$00
SEC
SBC #$03
STA Object_h_speed_hi,x
ChangeObjectState #$07, #$02 ;Set the object's animation state (my dash action is 7)
;PlaySound #SFX_PLAYER_JUMP
+
RTS
Also, if this code helps you in any way feel free to use it!