Braduz

Basic State Switch

Jan 22nd, 2020
639
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer State;
  2. default
  3. {
  4.     state_entry()
  5.     {
  6.         State = 0;
  7.     }
  8.    
  9.     touch_start(integer num_detected)
  10.     {
  11.         if(State == 0)
  12.         {
  13.             //Your functions for this State
  14.         }
  15.         if(State == 1)
  16.         {
  17.             //Your functions for this State
  18.         }
  19.         if(State == 2)
  20.         {
  21.             //Your functions for this State
  22.         }
  23.         if(State == 3)
  24.         {
  25.             //Your functions for this State
  26.         }
  27.        
  28.        
  29.         // this is the final State and heads back to the first
  30.         if(State == 4)
  31.         {
  32.             //Your functions for this State
  33.             State = 0;
  34.         }
  35.         else
  36.         {
  37.             State++;
  38.         }
  39.        
  40.  
  41.        
  42.     }
  43. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×