[4.5.9] Drop through OneWay Tile (when down is pressed)

Jonny

Active member
This is a very short and simple tutorial solely because I've been searching for the ideal way to do this but couldn't find one.
I thought there might be some new users trying to do this same thing and struggling to find info like I was.
Note: In earlier versions of NesMaker this was done in the simplejump script, but going though older posts there seems to be issues with that method.
Please comment if there's an easier or better way to do this. I'm sure it's been done a million times before in 4.5.X but, like I say, I could'nt find any 'how to' info.

I made this work by adding a condition (check) to the physics script before it changes the OneWay Tile to a solid...

Find where +isOneWaySolid is defined (somewhere around line 570 or after) and add this before the Object_v_speed stuff...

Code:
;;; UPDATED CORRECTION - Thanks Dale ;;;

LDA gamepad
    AND #%00100000                  ;; DOWN GAMEPAD PRESS ;;
    BNE +doPressDown
 
    ;; DOWN NOT PRESSED ;;

    JMP +doneDownPress
+doPressDown:

    ;; DOWN IS PRESSED ;;
    
    JMP +notSolid                   ;; DONT MAKE SOLID    ;;
+doneDownPress:

droponeway.gif
 
Last edited:

Jonny

Active member
I forgot to mention that I had to put a JMP in before this because the added code pushed it too far for a branch. So, if you try it and get an 'out of range' error that's what needs fixing.
 

dale_coop

Moderator
Staff member
Great idea...
I would just like to point out that the comments are not correct.

It should be:
Code:
    LDA gamepad
    AND #%00100000                  ;; DOWN GAMEPAD PRESS ;;
    BNE +doPressDown
   
    ;; HERE the DOWN button is NOT pressed ;;

    JMP +doneDownPress
+doPressDown:
    JMP +notSolid                   ;; DONT MAKE SOLID    ;;
+doneDownPress:
 

Jonny

Active member
You're right, I've got it back to front... sorry about that.

I've updated original post with this...

Code:
    LDA gamepad
    AND #%00100000                  ;; DOWN GAMEPAD PRESS ;;
    BNE +doPressDown
  
    ;; DOWN NOT PRESSED ;;

    JMP +doneDownPress
+doPressDown:

    ;; DOWN IS PRESSED ;;
    
    JMP +notSolid                   ;; DONT MAKE SOLID    ;;
+doneDownPress:
 

dale_coop

Moderator
Staff member
Your script was great btw, it was just the label and comment that might have confused some nesmaker users ;)
Thank you for sharing it :)
 

Jonny

Active member
Definitely. I'd rather it was correct so thank you.

I'm doing a dash attack next. I'll do a better job of checking it all next time 🙂
 

Subotai

Member
Good job Jonny and thanks for sharing your script.

When you say : forgot to mention that I had to put a JMP in before this because the added code pushed it too far for a branch. So, if you try it and get an 'out of range' error that's what needs fixing.

We must Jump to what ?

Code:
    JMP to ????
    LDA gamepad
    AND #%00100000                  ;; DOWN GAMEPAD PRESS ;;
    BNE +doPressDown

    ;; DOWN NOT PRESSED ;;

    JMP +doneDownPress
+doPressDown:

    ;; DOWN IS PRESSED ;;
   
    JMP +notSolid                   ;; DONT MAKE SOLID    ;;
+doneDownPress:
 

dale_coop

Moderator
Staff member
When you have a 'branch out of range' error on a, for example:
Code:
  BEQ +doThis     ;; if is equal branch out to the next +doThis label

You need to reverse the condition and do a jump:
Code:
  BNE +skipThis     ;; if is NOT equal branch out to the next +skipThis label
  JUMP +doThis    ;; else, jump to the next +doThis label
+skipThis:
 

Subotai

Member
When you have a 'branch out of range' error on a, for example:
Code:
  BEQ +doThis     ;; if is equal branch out to the next +doThis label

You need to reverse the condition and do a jump:
Code:
  BNE +skipThis     ;; if is NOT equal branch out to the next +skipThis label
  JUMP +doThis    ;; else, jump to the next +doThis label
+skipThis:

Like this ?

Code:
    ;;; UPDATED CORRECTION - Thanks Dale ;;;
    BNE +skipThis
        JUMP +doThis
        +doThis
        LDA gamepad
        AND #%00100000                  ;; DOWN GAMEPAD PRESS ;;
        BNE +doPressDown
        ;; DOWN NOT PRESSED ;;
        JMP +doneDownPress
        +doPressDown:
        ;; DOWN IS PRESSED ;;
        JMP +notSolid                   ;; DONT MAKE SOLID    ;;
        +doneDownPress:
    +skipThis

It gives me "illegal instruction" on line : JUMP +doThis
 

Jonny

Active member
Apologies all, I should have explained that part properly in the original post. Glad you got it working though.
 

Jonny

Active member
I thought pressing down + a does that already?
Was it changed in the newer versions?
It didn't work like that for me (obviously) but tbh you got me thinking now! I don't recollect changing anything that would stop that function.

I know for earlier versions I didn't have to do anything as it was part of the jump script (press down and jump button).
 
Top Bottom