Finally fixed my "wrong release jump animations when running" problems

dale_coop

Moderator
Staff member
I know the platformer module is not released yet, so a lot of my issues might already be fixed when released... but I can't stop myself for digging' in the code.
I was having an animation problem... when my player run (holding direction) and pressing the jump button... while still holding direction.
The problem was when the player got back on the ground (and still holding direction), the animation was "idle" when I was assuming it should be "running".
Same problem, with screen changing... if the player keeps running, when he changes screen, the new screen loads, the animation become the wrong one (idle).

But I found a fix...

The result is great, a video here :

("Untitled - Movement Animations Tests" on YouTube)


Here the part of "AccAndSpeed_Plateform_Simple.asm" that needs to be modified:
Code:
theGroundIsSolid:
	LDA Object_type,x
	BNE AboveIsSolid ;; does every object need this determination for *jumping*?
	LDA onGround
	BNE AboveIsSolid ;; it is alrady solid.
	;; if it wasn't solid, set it to solid, and change from jumping to normal
	LDA #$00;
	STA onLadder
	LDA #$01
	STA onGround
			LDA gamepad  ;; dale_coop: check the GamePad, if still moving ?
			AND #%11110000  
			BNE theGroundIsSolidWalking  ;; dale_coop
	;;ChangeObjectState #$00, #$02
	LDA Object_movement,x
	AND #%00001111
	STA Object_movement,x
 			ChangeObjectState #$00, #$02
			JMP AboveIsSolid
theGroundIsSolidWalking:
			ChangeObjectState #$01, #$02
AboveIsSolid:
 

jorotroid

Member
Awesome! Thanks. I was having this problem, too, but it was pretty low on my priority list. I'll have to look into implementing your fix.
 

jorotroid

Member
Works great! Thanks again for putting that together. One thing I changed is that I just AND the gamepad with #%11000000 instead of #%11110000 because then it's only checking if Left or Right are being pressed. With #%11110000 it meant that if I were jumping and held only Up or Down as I land, the player character would still transition to the Running animation.
 
Top Bottom