Advertisement
Ulabael

oGrid_create_new_code

Jul 15th, 2022
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cells_x = 75
  2. cells_y = 75
  3.  
  4. global.grid = ds_grid_create(cells_x, cells_y)
  5. global.grid_array = []
  6. room_width = cells_x * CellWidth
  7. room_height = cells_y * CellHeight
  8.  
  9. // Список тайлов, которые мы будем отрисовывать
  10. enum Tile
  11. {
  12.     air,
  13.     ground,
  14.     stone1,
  15.     metal,
  16.     coal
  17. }
  18.  
  19. // Объекты, которые будем отрисовывать
  20. global.TileObjects = [noone, oDirt, oRock, oMetal, oCoal]
  21.  
  22. enum Shadows
  23. {
  24.     none,
  25.     ground,
  26.     stone1,
  27.     stone2,
  28.     stone3,
  29.     stone4,
  30.     stone5,
  31.     metal,
  32.     coal
  33. }
  34.  
  35. var lay_id_blocks = layer_get_id("BlockLayer");
  36. var map_id_blocks = layer_tilemap_get_id(lay_id_blocks);
  37. var lay_id_shadows = layer_get_id("ShadowLayer");
  38. var map_id_shadows = layer_tilemap_get_id(lay_id_shadows);
  39. for (var _y = 0; _y < cells_y; ++_y)
  40. {
  41.     for (var _x = 0; _x < cells_x; ++_x)
  42.     {
  43.         ds_grid_set(global.grid, _x, _y, 0) // 0 - это стоимость клетки. Ноль - значит непроходима.
  44.         tilemap_set(map_id_blocks, Tile.ground, _x, _y)
  45.         tilemap_set(map_id_shadows, 47, _x, _y)
  46.         // Х, Y, клетка земли, клетка тени
  47.         array_push(global.grid_array, [_x, _y, Tile.ground, 47])
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement