4.5.6 Jump Action

mkjake63

Member
I was able to change the action to jump when pressing (a) but it stays that way the entire time. I was wondering how I would go about having it so he's idle as soon as he lands and how to set it up so when he's falling he's in a jump state or fall state
 

TurtleRescueNES

Active member
If you want to have a different appearance to your character when its falling (let's say he has a cape and you want it to flow upward), you could add a change state command to the InputVariableJump script.
One thing to be aware of is that the jump script expects you to be in a certain state and stops you from doing a double jump. If when falling, your character is in a different state, you have to plan for that and make sure you can re-jump while falling.
 

Logana

Well-known member
So you would have to time the animation to have the falling frame when your character is falling and then set the animation speed to got to first when done then change the animation settings till they line up, and that should work
 

mkjake63

Member
How about getting it to be in the idle state when it lands? I'm guessing you'd have to check if below it is solid and then it turns back to state 0 but I'm not really sure where I'd even put that :?:
 

mouse spirit

Well-known member
In 4.1.5 and probly maybe 4.5, there is a check for if on ground or if not on ground,
Code:
LDA Object_physics_byte,x
    AND #%00000001 ;; is it on the ground?
 

TurtleRescueNES

Active member
I know this may not be a great answer, but we're supposed to get a final round of tutorials this week. Maybe focus on something else and let's see if the new tutorials address the jumping mechanics.
 
Hey guys. If you are using the arcade platformer module, it's missing a part of code in its doHandlePhysics script. That's why when you jump, you land on the ground and you stay in a jump state.

you have to change the "doHandlePhysics_ArcadePlatformBase.asm" code, at line 544, and paste the following :


Code:
;;check if in a jumping state.
	TXA
	STA temp
	GetActionStep temp
	CMP #$02 ;; presums jump is in state 2
	BNE +dontChangeToIdle
		LDA gamepad
        AND #%11110000
		BNE +isRunningWhenLanding
			;; is idle when landing
			LDA #$00
			STA temp1
			JMP +gotLandingState
		+isRunningWhenLanding
			LDA #$01
			STA temp1
		+gotLandingState
			ChangeActionStep temp, temp1 ;; changes to either idle or running depending on if a direction key is pressed.
	+dontChangeToIdle

It's almost at the bottom of the script, just after the line 'isSolidSoLand"
 
Top Bottom