Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1.  
  2. switch(mode) {
  3.  
  4.  
  5. // Ammutaan luoteja spiraalin muotoisesti
  6. case spr_powerup_spiraali:
  7. i = instance_create_depth(x,y,0, obj_ammus);
  8.  
  9. i.direction = image_angle + aika * 100; //suunta muuttuu ajan suhteen
  10. i.speed = speed + 5;
  11. break;
  12.  
  13. //Jätetään maahan vauhdittomia luoteja miinoina
  14. case spr_powerup_miina:
  15. if (aika % 30 == 1) { ///Sekunnin välein (jos aika on jaollinen 30:lla (ruudunpäivitysnopeus))
  16. i = instance_create_depth(x,y,0, obj_ammus);
  17. }
  18. break;
  19.  
  20. //Ammutaan vuorotellen 2 luotia viistosti joko eteen tai taakse
  21. case spr_powerup_sarja:
  22. //Luodaan ensimmäinen ammus
  23. i1 = instance_create_depth(x,y,0, obj_ammus);
  24. i1.speed = speed + 15;
  25.  
  26. //Luodaan toinen ammus
  27. i2 = instance_create_depth(x,y,0, obj_ammus);
  28. i2.speed = speed + 15;
  29.  
  30. // % palauttaa jakojäännöksen: 1 % 2 = 1, 2 % 2 = 0, 3 % 2 = 1 jne
  31. if (current_second % 2 == 0) { //Suoritetaan joka toinen sekunti (kun sekunti jaollinen kahdella eli parillinen)
  32. i1.direction = image_angle + 45;
  33. i2.direction = image_angle - 45;
  34. }
  35. else {
  36. i1.direction = image_angle + 180 + 45;
  37. i2.direction = image_angle + 180 - 45;
  38. }
  39. break;
  40.  
  41. case spr_powerup_keha:
  42. for(var suunta = 0; suunta < 360; suunta += 1) {
  43. i = instance_create_depth(x,y,0, obj_ammus);
  44. i.speed = speed + 15;
  45. i.direction = suunta;
  46. }
  47. obj_alus.mode = -1;
  48. break;
  49.  
  50. case spr_powerup_boost:
  51. repeat(3) {
  52. i = instance_create_depth(x,y,0, obj_ammus);
  53. i.speed = speed + 15;
  54. i.direction = image_angle + random_range( -10,10 );
  55. }
  56. break;
  57.  
  58. default:
  59. if !keyboard_check(ord("X")) or (voi_ampua == false) break;
  60. i = instance_create_depth(x,y,0, obj_ammus);
  61. i.speed = speed + 15;
  62. i.direction = image_angle;
  63. break;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement