[4.5.6] Going DOWN though, Jump through platform blocks

DocNES

Member
(metro-vania scrolling module)

I really enjoy having the Jump Thought Platform, but I'm looking for a way to go back down though them in classic NES Game fashion ( b + ↓ )

Mahalo!
 

SciNEStist

Well-known member
in the physics script, there is a sectiion called "+isOneWaySolid" that is where you will want to add your code that can split between jumping to "isSolidSoLand" or "+notsolid"

Theres lots you can do there, you will have to pick the best method that suits your game. you could check player inputs using LDA gamepad, or you could check the action step of the player and set up some inputs to change to it.

I think the best method is to alter the jump input script to check if the player is already pressing down, then changing to an action step designated for "jumping down". then set your physics script to check for that action step and go +notsolid if it matches up.
 
I agree with SciNEStist, here is what i am using in the physics-script in my game.
I think i copy-pasted it from the forums last year. Did not find the original post right now..
And it may not be the best way. But it works for me :)

+isOneWaySolid
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Added code for dropthrougt oneway tile when down is pressed
CPX player1_object
BNE +doneDownPress

LDA gamepad
AND #%00100000 ;; Down GAMEPAD PRESS ;;
BNE +doPressDown
JMP +doneDownPress ;; Down not PRESSED ;;

+doPressDown: ;; Down is PRESSED ;;

LDA gamepad
AND #%00000010 ;; is the b button pressed?
BNE +
JMP +doneDownPress

+
;;Lets change player to jump
ChangeActionStep #$00, #$02
;arg0 = what object?
;arg1 = what step?
;;

JMP +notSolid ;; DONT MAKE SOLID ;;

+doneDownPress:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End added code for dropthroug oneway tile

;; a special kind of solid
 

Jonny

Well-known member
I'm doing almost the exact same thing but I like press down to fall off one-way solid. Going into jump state can give a nice fall animation without actually making another state for falling.

Code:
    LDA gamepad
    AND #%00100000                 
    BNE doPressDown
    JMP doneDownPress
doPressDown:
    ChangeActionStep player1_object, #$02
    JMP +notSolid                   
doneDownPress:
 

SciNEStist

Well-known member
if you do it that way, DO NOT FORGET: add a check to make sure your object is the player1 object. otherwise, everything will fall through any 1 way platform as you press down and jump
 
Last edited:

DocNES

Member
Thank you!

Struggling with BEQ out of Range Errors. Know I need to change it to BNE, and reverse the logic. Just not sure how to do that part. I put it in bold so its easier to see. I have abandaid on it. Skips over the code for checking slopes, and other platforms though. I can only run half of the jump through script before I get an other Out of Range Error. No action state change or need to press down and B.

I can now have the Player jump through a one way platform, but won't work on slopes. Thanks to @SciNEStist stopped the monster objects from jumping down too :)
+isLadderSolid
LDA Object_v_speed_hi,x
BEQ +checkSolid
BPL +checkSolid
JMP +notSolid
+checkSolid
LDA temp1
SEC
SBC #$02
SEC
SBC Object_v_speed_hi,x
STA tempy
GetCollisionPoint temp, tempy, tempA ;; is it a solid
BEQ +checkForSecondPoint
CMP #$0A
BEQ +notSolid ;;; <<<-----------Was getting out of range when adding the Down thought plat script.
;;BNE +skipThis ;; To enable Jump Down Thought platforms
jmp +notSolid ;;; Remove to enable down though platforms
GetCollisionPoint temp3, tempy, tempB ;; is it a solid?
BEQ +checkForFirstPoint
CMP #$0A
BEQ +notSolid
JMP +isMidTileSolid
+checkForSecondPoint
GetCollisionPoint temp3, tempy, tempB ;; is it a solid?
BEQ +isMidTileSolid
JMP +notSolid
+checkForFirstPoint
GetCollisionPoint temp, tempy, tempA ;; is it a solid?
BEQ +isMidTileSolid
JMP +notSolid
+isMidTileSolid
jmp +isSolidOnSlope

+isOneWaySolid


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Added code for dropthrougt oneway tile when down is pressed
CPX player1_object
BNE +doneDownPress

LDA gamepad
AND #%00100000 ;; Down GAMEPAD PRESS ;;
BNE +doPressDown
JMP +doneDownPress ;; Down not PRESSED ;;

+doPressDown: ;; Down is PRESSED ;;

LDA gamepad
AND #%00000010 ;; is the b button pressed?
BNE +
JMP +doneDownPress

+
;;Lets change player to jump
ChangeActionStep #$00, #$02
;arg0 = what object?
;arg1 = what step?
;;

JMP +notSolid ;; DONT MAKE SOLID ;;

+doneDownPress:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End added code for dropthroug oneway tile

;; a special kind of solid
 

NightMusic

Member
does anyone have a 4.5.9 script or can explain this? I tried to edit my Tile collisions script and also was editing my input script for jumpthroughplat.
I'm looking to do a down and a button to fall through platforms. please and thank you.
 

dale_coop

Moderator
Staff member
For the 4.5.9, I would just modify the jump_throughPlat.asm input script to add a code like this:
Code:
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed
            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:
Maybe just after the check for the one-way platform tiles:
Code:
    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 
;; HERE
 

NightMusic

Member
For the 4.5.9, I would just modify the jump_throughPlat.asm input script to add a code like this:
Code:
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed
            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:
Maybe just after the check for the one-way platform tiles:
Code:
    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
;; HERE
Thank you! I did this and it does work but it's really tricky to pull off. It works once and awhile if I keep jamming down and a. I have no idea why it works sometimes and not all times. It does work though, just rarely or the button press window of time must be miniscule.
 

NightMusic

Member
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 +noJumpYet
        JMP +doJump
     +noJumpYet
   
    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 +noJumpYet
        JMP +doJump
     +noJumpYet
   
    CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                       ;;; if it is (equal), can jump.
    BNE +noJumpYet                                    ;;; if not, skips jumping.
        JMP +doJump   ;; check second point.
+noJumpYet
        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.
        BEQ +doJump                                    ;;; if not, skips jumping.        
       
       
        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
;; this checks if down + A is pressed if so fall through the tile ;;

        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed

            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:

         CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                      ;;; if it is (equal), can jump.
                                        ;;; if not, skips jumping.
        BEQ +doJump   ;; check second point.
            JMP +skipJumping
+doJump:

    TXA
    STA temp ;; assumes the object we want to move is in x.

;; EDIT TO ADD ACTION CHANGE IN PLAYER ;;
    ChangeActionStep temp, #$02 ;; assumes that "jump" is in action 2
            ;arg0 = what object?
            ;arg1 = what behavior?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    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.

+skipJumping:
    ReturnBank
    RTS


thank you
 
Last edited:

dale_coop

Moderator
Staff member
The
Code:
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed

            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:

Needs to be placed before the JMP +doJump line of each collision check with a jumpthrough platform.
(means it should be added twice in the script. And not where you placed it)


Like this:
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 +noJumpYet
        JMP +doJump
     +noJumpYet
    
    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 +noJumpYet
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;; this checks if down + A is pressed if so fall through the tile ;;
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed

            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        JMP +doJump
     +noJumpYet
    
    CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                       ;;; if it is (equal), can jump.
    BNE +noJumpYet                                    ;;; if not, skips jumping.
        JMP +doJump   ;; check second point.
+noJumpYet
        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.
        BEQ +doJump                                    ;;; if not, skips jumping.         
        
        
        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
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;; this checks if down + A is pressed if so fall through the tile ;;
            LDA gamepad
            AND #%00100001     ;; DOWN + A buttons pressed
            CMP #%00100001
            BNE +doneDownAPressed

                LDA Object_y_hi,x
                CLC
                ADC #$03
                STA Object_y_hi,x
                JMP +skipJumping
            +doneDownAPressed:
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            JMP +doJump
        +checkMore:

        CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                      ;;; if it is (equal), can jump.
                                        ;;; if not, skips jumping.
        BEQ +doJump   ;; check second point.
            JMP +skipJumping
+doJump:

    TXA
    STA temp ;; assumes the object we want to move is in x.

;; EDIT TO ADD ACTION CHANGE IN PLAYER ;;
    ChangeActionStep temp, #$02 ;; assumes that "jump" is in action 2
            ;arg0 = what object?
            ;arg1 = what behavior?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    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.

+skipJumping:
    ReturnBank
    RTS
 

NightMusic

Member
The
Code:
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed

            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:

Needs to be placed before the JMP +doJump line of each collision check with a jumpthrough platform.
(means it should be added twice in the script. And not where you placed it)


Like this:
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 +noJumpYet
        JMP +doJump
     +noJumpYet
  
    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 +noJumpYet
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;; this checks if down + A is pressed if so fall through the tile ;;
        LDA gamepad
        AND #%00100001     ;; DOWN + A buttons pressed
        CMP #%00100001
        BNE +doneDownAPressed

            LDA Object_y_hi,x
            CLC
            ADC #$03
            STA Object_y_hi,x
            JMP +skipJumping
        +doneDownAPressed:
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        JMP +doJump
     +noJumpYet
  
    CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                       ;;; if it is (equal), can jump.
    BNE +noJumpYet                                    ;;; if not, skips jumping.
        JMP +doJump   ;; check second point.
+noJumpYet
        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.
        BEQ +doJump                                    ;;; if not, skips jumping.       
      
      
        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
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;; this checks if down + A is pressed if so fall through the tile ;;
            LDA gamepad
            AND #%00100001     ;; DOWN + A buttons pressed
            CMP #%00100001
            BNE +doneDownAPressed

                LDA Object_y_hi,x
                CLC
                ADC #$03
                STA Object_y_hi,x
                JMP +skipJumping
            +doneDownAPressed:
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            JMP +doJump
        +checkMore:

        CheckCollisionPoint temp, temp1, #$0A, tempA ;; check below feet to see if it is ladder top platform.
                                      ;;; if it is (equal), can jump.
                                        ;;; if not, skips jumping.
        BEQ +doJump   ;; check second point.
            JMP +skipJumping
+doJump:

    TXA
    STA temp ;; assumes the object we want to move is in x.

;; EDIT TO ADD ACTION CHANGE IN PLAYER ;;
    ChangeActionStep temp, #$02 ;; assumes that "jump" is in action 2
            ;arg0 = what object?
            ;arg1 = what behavior?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    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.

+skipJumping:
    ReturnBank
    RTS
thank you :) I hope you have a great day!

View: https://youtu.be/lBql-b72dJs

@dale_coop "damn good programmer"
 
Last edited:
Top Bottom