Adding skiing...

  • Thread starter Thread starter Jisatsu Ouja
  • Start date Start date
J

Jisatsu Ouja

Guest
I'm trying to find various ways to approach this and I was hoping for some advice...

Essentially what I'm trying to do is create a function that will set a player's friction to 0 whenever the player enters the air (either by jumping or another method) and then sets the friction from 0 to default over 2 seconds when they make contact with a surface (land) but will cancel the friction reset and set it back to zero should the player jump or go airborne again...

My theory code would be something along the lines of...

Code:
void ski_friction_set(*pPlayer, gamestate)
{
	// i'm not sure how the game time counts...
	// "ground" and "air" when referring to gamestate
	// are just examples of the actual state i'm looking for
	myGameTime = gametime;
	if (*pPlayer.Friction == 0 && gamestate == "ground")
	{
		funcState = "default";
		while (*pPlayer.Friction != defaultvalue[unknown] && funcState == "default")
		{
			// not sure how to do this...
			if (myGameTime != (gametime - 2000) && myGameTime > (gametime - 2000) && *pPlayer.Friction != defaultvalue[unknown])
			{
				// assuming 1000 is 1000 miliseconds or 1 second
				*pPlayer.Friction++;
			}
			elseif (myGameTime == (gametime - 2000) || myGameTime < (gametime - 2000))
			{
				// *pPlayer.Friction should be set to default already
				funcState = "finished";
			}
		}
	}
	elseif (*pPlayer.Friction != 0 && gamestate == "air")
	{
		*pPlayer.Friction = 0;
	}
}

And then I want to tie that in everytime the player jumps... which we have come to believe is in hl_gamemovement.cpp on line 1086.

Any advice would be appreciated.
 
Working on a TRIBES port? Interesting. I wish I could help you out on this but I've just started working with the SDK a few weeks ago.
 
Skiing... Wouldn't that involve going downhill with as little friction as possible? Why would you have friction at default when you're on a slope, and then turn to zero when you jump?
Explain a little more of your movement concept, and I'll try and find you an answer.

-Angry Lawyer
 
Back
Top