Guest User

Untitled

a guest
Jan 21st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. globalvar field;
  2. var chance, _x, _y, o, d, r, n, l;
  3.  
  4. q_create(room_width, room_height, 1)
  5. // зоны
  6. // пещера
  7. bc[1, 1] = 1000
  8. bc[1, 2] = room_height
  9. bc[2, 1] = 1000
  10. bc[2, 2] = 3000
  11. bc[3, 1] = 3000
  12. bc[4, 1] = 4000
  13.  
  14. // герой
  15. _x = room_width / 2
  16. _y = room_height / 2
  17. instance_create(_x, _y, player)
  18. drop(_x + 24, _y, 7, -1)
  19. drop(_x - 24, _y, 8, -1)
  20. o = instance_create(_x + 128 * choose(-1, 1), _y, tree)
  21. o.c = irandom_range(3, 6)
  22. o.sprite_index = execute_string("return spr_tree" + string(o.c))
  23.  
  24. // пещера
  25. for(i = 0; i <= room_width; i += 1)
  26. {
  27.     for(j = 0; j <= room_height; j += 1)
  28.     {
  29.         if irandom(30) == 1
  30.         {
  31.             repeat(irandom(208))
  32.             {
  33.                 set_region(i, j, i + irandom_range(5, 25) * choose(-1, 1), j + irandom_range(4, 10), 0)
  34.             }
  35.         }
  36.         if irandom(10) == 1
  37.         {
  38.             r = irandom(3)
  39.             set_region(i - r, j - r, i + r, j + r, 0)
  40.         }
  41.     }
  42. }
  43.  
  44. set_region(0, room_width div 32, 0, bc[1, 1] div 32, 0)
  45.  
  46. repeat(irandom_range(10, 180))
  47. {
  48.     _x = (irandom_range(128, room_width)) div 32
  49.     _y = (irandom_range(128, room_height)) div 32
  50.     set_region(_x, _y, _x + irandom_range(1, 20) * choose(-1, 1), _y + irandom_range(1, 20) * choose(-1, 1))
  51. }
  52.  
  53. // лианы
  54. for(i = 0; i < room_width div 32; i += 1)
  55. {
  56.     for(j = 0; j < room_height div 32; j += 1)
  57.     {
  58.         if field[i, j] == 1 or field[i, j] == 2
  59.         {
  60.             if irandom(10) == 1
  61.             {
  62.                 if j < (room_height div 32) - 1
  63.                 {
  64.                     if !block_solid[field[i, j + 1]]
  65.                     {
  66.                         instance_create(i * 32, j * 32 + 16, liana)
  67.                         n = irandom_range(5, 10)
  68.                         for(l = 1; l < n + 1; l += 1)
  69.                         {
  70.                             instance_create(i * 32, j * 32 + 16 + irandom_range(4, 7) + l * 2, liana)
  71.                         }
  72.                     }
  73.                 }
  74.             }
  75.         }
  76.     }
  77. }
  78.  
  79. // деревья
  80. repeat(irandom_range(20, 70))
  81. {
  82.     instance_create(random(room_width), random(room_height), tree)
  83. }
  84.  
  85. // шипы
  86. repeat(irandom_range(20, 60))
  87. {
  88.     instance_create(random(room_width), random(room_height), spike)
  89. }
  90.  
  91. //магазин
  92. //instance_create(random_range(64, room_width - 64), random_range(64, room_height - 64), shopguy)
  93. instance_create(spawn[1] + random_range(64, 512) * choose(-1, 1), spawn[2] + random_range(64, 512) * choose(-1, 1), shopguy)
  94.  
  95. // чёрные ящики
  96. repeat(10)
  97. {
  98.     instance_create(random(room_width), random(room_height), blackbox)
  99. }
  100.  
  101. // coinbox
  102. instance_create(random(room_width), random(room_height), coinbox)
Add Comment
Please, Sign In to add comment