Can't run and jump

Dirk

Member
Hello, I have noticed that often, but seemingly not always, my player won't jump while he is running. I have to stop running and try again. That makes a platformer unnecessary difficult.
Does anybody know a fix?
 

dale_coop

Moderator
Staff member
Strange, never had this problem with run and jump...
Did you modify the playerJump script?
How are assigned your movement (running) inputs? on "PRESS" or "HOLD"? Can you share a screenhot?
 

Dirk

Member
I think I noticed in "Witches Weed" too.
I didn't change the playerJump script and I assigned the scripts like in the tutorial.
I'll post screenshots and double check my key assignments later.
 

Dirk

Member
Okay, this is my input setup:

help_input_script.png

And this are my scripts:

ChangeToIdleAnimation:
Code:
    LDX player1_object
    
    LDA gamepad
    AND #%11110000
    BNE skipChangeToidle
    ;LDA onGround
   
    LDA Object_status,x
    AND #%00000100 ;; not on ground
    BEQ skipChangeToidle
    
    
    ChangeObjectState #$00, #$02

skipChangeToidle:
    RTS


ChangeToWalkingAnimation:

Code:
    LDX player1_object
    LDA Object_status,x
    AND #%00000100
    BEQ +
    ChangeObjectState #$01, #$02
    +
  
    RTS


StartMovingPlayerLeft:

Code:
    StartMoving player1_object, MOVE_LEFT
        LDA Object_movement,x
        ORA #%00000110
    STA Object_movement,x
    ;;;        000 down
    ;;;        001 down right
    ;;;        010 right
    ;;;        011 up right
    ;;;        100 up
    ;;;        101 up left
    ;;;        110 left
    ;;;        111 down left
    
    RTS


StartMovingPlayerRight:

Code:
    StartMoving player1_object, MOVE_RIGHT
        LDA Object_movement,x
        ORA #%00000010
    STA Object_movement,x
    ;;;        000 down
    ;;;        001 down right
    ;;;        010 right
    ;;;        011 up right
    ;;;        100 up
    ;;;        101 up left
    ;;;        110 left
    ;;;        111 down left
    
    RTS


StopMovingPlayerLeft:

Code:
    StopMoving player1_object, STOP_LEFT
    rts


StopMovingPlayerRight:

Code:
    StopMoving player1_object, STOP_RIGHT
    rts


playerJump:

Code:
LDX player1_object
LDA Object_status,x
AND #%00000100
BEQ +
LDA #$00
SEC
SBC #$06  
STA Object_v_speed_hi,x
LDA Object_status,x
AND #%11111011
STA Object_status,x
ChangeObjectState #$02, #$02
PlaySound #SFX_PLAYER_JUMP
+
RTS


varJumpRelease:

Code:
LDX player1_object
LDA Object_v_speed_hi,x
BPL skipVarJump
LDA #$00
SEC
SBC #$03

STA Object_v_speed_hi,x
skipVarJump:
RTS
 

dale_coop

Moderator
Staff member
I use the same input settings, the same scripts... and don't have any particular issue with the platformer module, when my player 's running and jumping. I am using the 4.0.11 too.
Hmm... could share a small video showing issue?
 

Dirk

Member
:lol: I just made a simple level so I could run left and right and make a video to show my problem. I also downloaded FCEUX, because it shows your inputs (is there such an option for Mesen?). Mesen and FCEUX behave the same way when I run and jump to the right -> no jumping; to the left -> it works.
Now I changed my input from "J" for running and "K" to jumping to "L" for jumping... and guess what... now I can run and jump!
I still don't understand why it works if the direction is to the left, but not when it's to the right, because in both cases I used to press "J"+"K", so "A"+"J"+"K" works, but "D"+"J"+"K" doesn't :shock:

Thanks for your help dale_coop and looking over my input setup and scripts.
 
Top Bottom