Is there any way to have the players sprite change when they jump??? Like how Player.CrouchSprite defines the sprite when the player crouches?? Its very glaring visually when I jump in my project when the player is just thrusted in the air with no visual movement. I've searched the wiki for a while, including jumping, and I see no way to define sprites for jumping or anything similar so if anyone can help me with this I'd greatly appreciate it.
Re: Jumping Sprites???
Posted: Wed May 19, 2021 6:48 am
by Jarewill
You could do a velocity check and jump to specific states. It's not perfect, but that's the best thing I can think of.
Class JumpPlayer : DoomPlayer { States { Spawn: TNT1 A 0 A_CheckJump("Jump","Fall");//Example usage of the custom function PLAY A 1; Loop; See: TNT1 A 0 A_CheckJump("Jump","Fall"); PLAY ABCD 4; Loop; Jump: POSS A 1; Goto Spawn; Fall: SPOS A 1; Goto Spawn; Missile: TNT1 A 0 A_CheckJump("JumpMissile","FallMissile"); PLAY E 12; Goto Spawn; JumpMissile: POSS E 12; Goto Spawn; FallMissile: SPOS E 12; Goto Spawn; Melee: TNT1 A 0 A_CheckJump("JumpMelee","FallMelee"); PLAY F 6 BRIGHT; Goto Missile; JumpMelee: POSS F 6 BRIGHT; Goto JumpMissile; FallMelee: SPOS F 6 BRIGHT; Goto FallMissile; } Action state A_CheckJump(statelabel jumpstate, statelabel fallstate)//This is the custom function that checks for the Z velocity { FLineTraceData h; self.LineTrace(0,8,90,TRF_THRUSPECIES,1,data: h); If(h.HitType==TRACE_HitNone)//If the player is standing on nothing { If(self.vel.z>0){Return ResolveState(jumpstate);}//If the Z velocity is above 0, jump to the jump state Else If(self.vel.z<0){Return ResolveState(fallstate);}//If it's below 0, jump to the fall state Else{Return null;} } Else{Return null;} } }
Note that you don't need to rewrite your player class if you are doing it in DECORATE. You just need to make your class inherit from this ZScript one and you will be able to use the function in DECORATE. Just delete the example states as they might mess with something.