Advertisement
Guest User

Simon says

a guest
Feb 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. colors = array( "verde", "rojo","amarillo ", "azul");
  2. sec = [];
  3. for(i=0;i<colors.size;i++)
  4. sec[i] = colors[randomint(colors.size)];
  5.  
  6. function pulsador1()
  7. {
  8. while(1)
  9. {
  10. wait 1;
  11. pulsador =GetEnt( "pulsador","targetname" );
  12. pulsador waittill("trigger",player);
  13. level thread color();
  14. }
  15. }
  16. function color()
  17. {
  18. level.color_random= randomint(4);
  19.  
  20. if( level.color_random == 0)// red
  21. {
  22. ArrayInsert(simon,"red");
  23. level thread red();
  24.  
  25.  
  26.  
  27. }
  28. if( level.color_random == 1)// green
  29. {
  30. ArrayInsert(simon,"green");
  31. level thread green();
  32.  
  33.  
  34.  
  35. }
  36. if( level.color_random == 2)// yellow
  37. {
  38. ArrayInsert(simon,"yellow");
  39. level thread yellow();
  40.  
  41.  
  42.  
  43. }
  44. if( level.color_random == 3)// blue
  45. {
  46. ArrayInsert(simon,"blue");
  47. level thread blue();
  48.  
  49.  
  50.  
  51. }
  52. level thread imprimir();
  53. }
  54.  
  55. function imprimir()
  56. {
  57. IPrintLnBold simon(0);
  58.  
  59. }
  60. function red()
  61. {
  62. rojo =GetEnt( "rojo","targetname" );
  63. rojo hide();
  64. wait 1;
  65. rojo show();
  66.  
  67. }
  68. function green()
  69. {
  70. verde =GetEnt( "verde","targetname" );
  71. verde hide();
  72. wait 1;
  73. verde show();
  74.  
  75. }
  76. function yellow()
  77. {
  78. amarillo =GetEnt( "amarillo","targetname" );
  79. amarillo hide();
  80. wait 1;
  81. amarillo show();
  82.  
  83. }
  84. function blue()
  85. {
  86. azul =GetEnt( "azul","targetname" );
  87. azul hide();
  88. wait 1;
  89. azul show();
  90.  
  91. }
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. function simon_says()
  99. {
  100. colors = ["rojo", "verde", "amarillo", "azul"];
  101. level.sec_simon_says_step = 0;
  102. level.sec_simon_says_num = 2;
  103. level.sec_simon_says_max = 5;
  104. level.sec_simon_says = [];
  105. for(i=0;i<num;i++)
  106. level.sec_simon_says[i] = colors[randomint(colors.size)];
  107. for(i=0;i<machines.size;i++)
  108. thread machine_trigger(machines[i]);
  109. }
  110.  
  111. function machine_trigger(color)
  112. {
  113. colors = ["rojo", "verde", "amarillo", "azul"];
  114. machine = GetEnt( color, "targetname" );
  115. trigger = GetEnt( "t_" + color, "targetname" );
  116. while(level.sec_simon_says.size <= level.sec_simon_says_max && level.sec_simon_says_step < level.sec_simon_says.size)
  117. {
  118. trigger waittill("trigger", player);
  119. if(level.sec_simon_says[level.sec_simon_says_step] == color)
  120. {
  121. machine hide();
  122. wait 1;
  123. machine show();
  124. level.sec_simon_says_step++;
  125. if(level.sec_simon_says_step >= level.sec_simon_says.size)
  126. {
  127. level.sec_simon_says_step = 0;
  128. level.sec_simon_says[level.sec_simon_says.size] = colors[randomint(colors.size)];
  129. }
  130. }
  131. else
  132. {
  133. level.sec_simon_says_step = 0;
  134. level.sec_simon_says = [];
  135. for(i=0;i<num;i++)
  136. level.sec_simon_says[i] = colors[randomint(colors.size)];
  137. }
  138. }
  139. //acabado
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement