Page 1 of 1

cycle options

Posted: Fri Aug 08, 2008 11:46 pm
by Agentarrow
how would I go about making weapons cycle when the player hits TAB?
this is much faster in a 4 weapon game like Terra Trooper.

Re: cycle options

Posted: Sat Aug 09, 2008 11:14 am
by Juutis
Check if TAB is pressed. Check if the last weapon (the one with the index 3) is armed and if so, change to the first weapon (with index 0). Otherwise change to the next weapon (current weapon + 1):

Code: Select all

if(IsKeyDown(13))
{
     if(player_weapon = 3)
     {
          SetPlayerWeapon(0);
     }
     else
     {
          SetPlayerWeapon(player_weapon + 1);
     }
}