viernes, 14 de agosto de 2015

Trick System Implementation

Performing tricks

Performing the first trick
Player must be in air. Depending on how this state is reached, there are 3 options:
  • Boost Jump: player boost jumped by pressing Trick just before leaving the ground. In this case the trickInputWindow timer will start the moment the Trick button is pushed before jumping and only a direction input must be supplied. 
  • Normal Jump/Fall: player jumps normally or falls from a cliff without jumping. The player must press the Trick button to start the trickinputWindow counter and then input a direction before the counter reaches 0.
 The 3rd option will be discussed on it´s own alongside the concepts of Chains, Links and Perfect Links.

Consecutive tricks: Chains, Link and Perfect Links
Just as the first trick ends, counter trickChain is set to trickChainMax. The user has to press the trick button before trickChain reaches 0 to perform a different trick. If the counter reaches 0 with no input no penalty will be applied, but the player will have lost the chance to score more points. Also, once the Trick button is pressed the counter trickInputWindow will be set to trickInputWindowMax and start counting: if it reaches 0 the same as for trickChain will happen. This creates the concepts of Links and Chains:
  • Chains: Chains are tricks that are performed in the same jump with no restrictions.
  • Links: If the player presses the Trick button at the correct moment as the previous trick is ending (trickChain > trickLink, set trickInputWindow=trickInputWindowMax) and inputs a direction the player will perform a Link instead of a Chain. The next trick will be performed faster and rack up more points.
  • Perfect Link: The same as Links, but the time window is much more narrower. The next trick will receive an ever bigger boost (score as well).
Pressing the trick button during a trick will not register.

Examples
TB+R=FlipF(L1)->TB+R=FlipF(L1)->TB+TB=Double FlipF (L2)
TB+R=FlipF(L1)->TB+R=FlipF(L1)->TB+U=Double FlipFSpin(L3)
TB+R=FlipF(L1)->TB+R=FlipF(L1)->TB+TB=DoubleFlipF(L2)->TB+U=Double FlipFSpin(L3)

 Implementation

stDrive: exitingRamp
if (trickJustPressed){
  trickInputWindow = trickInputWindowMax;
  trickLink = 0;
}

stJump

if (trickInputWindow > 0) LaunchTrick();
else if (trickJustPressed){
 trickInputWindow = trickInputWindowMax;
 LaunchTrick();//This allows simultaneous presses of TB+Direction
}

LaunchTrick
if (tricks.Count < 2){
 if (rightJustPressed) StartTrick(trickNFlipF);
 else if (...)
}else{
 if (rightJustpressed){
  if (tricks(tricks.Count-2) == trickNFlipF){
   if (tricks(tricks.Count-1))==trickNFlipF) StartTrick(trickNTripleFlipF);
   else if (tricks(tricks.Count-1))==trickNSpin) StartTrick(trickNDoubleFlipFSpin);
   }else if...
  }
 }
}

StartTrick(int newTrick)

trickInputWindow = 0;
currentTrick = newTrick;
tricks.Add(currentTrick);




switch (newTrick){
case trickNFlipF:
 trickTurns[axisZ] =  1;
 trickSpeed[axisZ] = -1;//Set speed according to Chain, Link or PerfectLink
break;

}


EndTrick()
currentTrick = -1;
trickChain = trickChainMax;


No hay comentarios:

Publicar un comentario