baardbi
Well-known member
PS!!!! This tutorial is outdated. I made a new tutorial that is much better:
I could't find an input script that enabled double jump in 4.5.6, so I thought I would make one myself. I thought I had a good idea, but now I'm not even sure that this will work at all...
In my game the player will get a double jump power up later in the game. To keep track of things I made two user variables. One variable checks if the player has the power up at all and the other varibale checks how many times the player has jumped (I just want him to be able to jump two times).
Am I way off or is there a chance to save my modified jump script? Here it is:
Modified jump_throughPlat.asm from the MOD_PlatformerBase (my modifications are at the bottom of the script)
Double Jump in Platform Games 4.5.9
This tutorial will add the ability to double jump in the platform modules (Arcade Platformer, MetroVania and LR Platformer). 1. Add a new User Variable: jumpCounter 2. In your jump_throughPlat.asm file add this at the top of the file under SwitchBank #$1C : ;;; Double jump check LDA...
www.nesmakers.com
I could't find an input script that enabled double jump in 4.5.6, so I thought I would make one myself. I thought I had a good idea, but now I'm not even sure that this will work at all...
In my game the player will get a double jump power up later in the game. To keep track of things I made two user variables. One variable checks if the player has the power up at all and the other varibale checks how many times the player has jumped (I just want him to be able to jump two times).
Am I way off or is there a chance to save my modified jump script? Here it is:
Modified jump_throughPlat.asm from the MOD_PlatformerBase (my modifications are at the bottom of the script)
Code:
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Only can jump if the place below feet is free.
SwitchBank #$1C
LDY Object_type,x
LDA ObjectBboxTop,y
CLC
ADC ObjectHeight,y
sta temp2
LDA Object_x_hi,x
CLC
ADC ObjectBboxLeft,y
STA temp
JSR getPointColTable
LDA Object_y_hi,x
CLC
ADC #$02
CLC
ADC temp2
STA temp1
CheckCollisionPoint temp, temp1, #$01, tempA ;; check below feet to see if it is solid.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +checkMore
JMP +doJump
+checkMore
CheckCollisionPoint temp, temp1, #$07, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +checkMore
JMP +doJump
+checkMore
CheckCollisionPoint temp, temp1, #$09, tempA ;; check below feet to see if it is prize block .
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +checkMore
JMP +doJump
+checkMore
CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +dontDoJump
JMP +doJump
+dontDoJump
;; check second point.
LDY Object_type,x
LDA ObjectWidth,y
CLC
ADC temp
STA temp
JSR getPointColTable
CheckCollisionPoint temp, temp1, #$01, tempA ;; check below feet to see if it is solid.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
CheckCollisionPoint temp, temp1, #$07, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
CheckCollisionPoint temp, temp1, #$09, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
JMP +skipJumping
;;;;;;;;;;;;;;;;;;; Baardbi modified start
doubleJump:
+doJump:
TXA
STA temp ;; assumes the object we want to move is in x.
;PlaySound #sfx_thump
LDY Object_type,x
LDA ObjectJumpSpeedLo,y
EOR #$FF
STA Object_v_speed_lo,x
LDA ObjectJumpSpeedHi,y
EOR #$FF
STA Object_v_speed_hi,x
TXA
STA temp ;; assumes the object we want to move is in x.
; change the object's action so that he is in jump mode.
LDA gotDoubleJump ;User variable to check if the player has double jump power up (1 = yes)
CMP #$01
BNE +skipJumping
INC doubleJumpCounter ;User variable that checks the number of times the player has jumped
LDA doubleJumpCounter
CMP #$02
BEQ noMoreDoubleJumpsForYou ;Has already jumped a second time
JMP doubleJump
noMoreDoubleJumpsForYou:
LDA #$00
STA doubleJumpCounter
RTS
+skipJumping:
ReturnBank
RTS
;;;;;;;;;;;;;;;;;;; Baardbi modified stop
Last edited: