;; checking the current state of the player:
GetCurrentActionType player1_object
CMP #$07 ;; if in "invisible" state
BNE +
;; skip the script:
RTS
+
;; from here the rest of the script:
; load the playerX_object (current inputs):
JSR PlayerXobjectInputs
goJump:
;; if on a cutscene:
LDA screenFlags
AND #%00000010
BEQ +
RTS
+
LDA isPaused
BEQ +
RTS
+
; a jumps
;LDX player1_object
;;; let's check for if we are standing on a jumpthrough platform,
;;; for which "down and jump" will jump downwards through
;;; comment this out if you do not want that functionality
LDA screenFlags
AND #%00100000 ;; does it use gravity?
BNE usingGravity
JMP dontJump
usingGravity:
LDA Object_physics_byte,x
AND #%00001000
BEQ notStandingOnJumpThroughPlatform
CPX player2_object
BNE +
LDA gamepad2
AND #%00100000 ;; pressing Down?
BEQ notStandingOnJumpThroughPlatform
JMP ++
+
LDA gamepad
AND #%00100000 ;; pressing Down?
BEQ notStandingOnJumpThroughPlatform
++
LDA Object_y_hi,x
CLC
ADC #$09
STA Object_y_hi,x
JMP dontJump
notStandingOnJumpThroughPlatform:
LDA Object_physics_byte,x
AND #%00000001
BNE canJump
LDA Object_physics_byte,x
AND #%00000100 ;; solid under player's feet ?
BNE canJump
JMP dontJump
;; jump on walls
; LDA collisionPoint2
; ORA collisionPoint3
; AND #%10000000
; BNE canJump
; LDA collisionPoint1
; ORA collisionPoint4
; AND #%10000000
; BNE canJump
;;JMP dontJump
canJump:
;PlaySound #SND_JUMP
canJumpAgain:
;;; TURN OFF "STANDING ON JUMPTHROUGH PLATFORM" if it is on
LDA Object_physics_byte,x
AND #%11110111
STA Object_physics_byte,x
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA #$00
SEC
SBC #JUMP_SPEED_LO
STA Object_v_speed_lo,x
LDA #$00
SEC
SBC #JUMP_SPEED_HI
STA Object_v_speed_hi,x
CPX player1_object
BEQ +
GetCurrentActionType player2_object
JMP ++
+
GetCurrentActionType player1_object
++
CMP #$03 ;; attack
BEQ +
ChangeObjectState #$02, #$04
+
;PlaySound #SND_JUMP
dontJump:
;; check if on trampoline:
LDA Object_x_hi,x
CLC
ADC Object_left,x
STA tileX
LDA Object_y_hi,x
CLC
ADC Object_bottom,x
CLC
ADC #$04 ;; <-- HERE: however far you want to check beneath the player
STA tileY
JSR GetTileAtPosition
LDA collisionTable,y
CLC
CMP #COL_TRAMPOLINE ;; the bounce tile type
BEQ JumpingOnTrampoline
JMP notJumpingOnTrampolineTile
JumpingOnTrampoline:
ChangeObjectState #$02, #$02
LDA #$00
SEC
SBC #$08 ;; <-- HERE, the TRAMPOLINE JUMP value
STA Object_v_speed_hi,x
notJumpingOnTrampolineTile:
RTS