Game Development Community

Powerup delay.

by Mark Junior · in Torque Game Engine · 10/29/2006 (7:59 am) · 0 replies

Hi, i just got a power up working which gives me more speed WOOHOO! but what i want to do is that in a certain amount of time my powerup effect will ware off... heres the code i have so far for the power up tell me what to add:
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
   if(%col.getClassName() $= "Player")
   {   
      echo("found strength upgrade");
      %obj.delete();
   
      //movement
      PlayerBody.maxForwardSpeed += 0.5;
      PlayerBody.maxBackwardSpeed += 0.5;
      PlayerBody.maxSideSpeed += 0.5;
      PlayerBody.maxUnderwaterForwardSpeed += 0.5;
      PlayerBody.maxUnderwaterBackwardSpeed += 0.5;
      PlayerBody.maxUnderwaterSideSpeed += 0.5;

      //jumping
      PlayerBody.jumpForce += 2;
      PlayerBody.recoverDelay--;
      PlayerBody.upMaxSpeed++;
   }
}

Any help apriciated.

P.S: i just gave you a tip for you noobies how to make a powerup :)

Post here or email me at : saska@kivisto.com