LDX player1_object
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; this is for platform game.
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
CMP #$01
BEQ +
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ +
ChangeObjectState #$01, #$04
JMP +
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;; END PLATFORM TYPE GAME
+
LDA Object_movement,x
AND #%00000111
CMP #%00000110 ;; is the player curenlty facing left ?
BNE ++
;; player was facing left:
FaceDirection player1_object, FACE_DOWN_LEFT
JMP +
++
CMP #%00000010 ;; is the player curenlty facing right ?
BNE +
;; player was facing right:
FaceDirection player1_object, FACE_DOWN_RIGHT
+
RTS
;;;; STOP PLAYER FROM MOVING LEFT
;;; Here, we will stop the player from moving,
StopMoving player1_object, STOP_LEFT
GetCurrentActionType player1_object
CMP #$02 ;; if the state is invincible
BEQ +
CMP #$03
BEQ + ; skip if we are casting spell
LDX player1_object
;;; and we will change the object state to idle.
ChangeObjectState #$00, #$04
LDA Object_movement,x
AND #%00000111
CMP #%00000111 ;; is the player was down left ?
BNE ++
;; player was facing left:
FaceDirection player1_object, FACE_LEFT
JMP +
++
CMP #%00000001 ;; is the player was down right ?
BNE +
;; player was facing right:
FaceDirection player1_object, FACE_RIGHT
+
RTS