Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // mapGridX.Y are positions in a dungeon layout called mainGrid.
  2.  
  3. solids = [0, 0]; //Create the array to store all the blocks
  4. roomNumber = 0; //tracks which roomNumber we're in
  5.  
  6. for (mapGridX = 0 ; mapGridX < ; gridW ; mapGridX++) {
  7.     for(mapGridY = mapGridY ; mapGridY < ; gridH  ; mapGridY++) {
  8.        
  9.         tileIndex = 0;
  10.  
  11.         // If i find a value less than 100 i populate with a specific layout,
  12.         // the addition of layouts to below mentioned roomGrid is cut out
  13.         if ds_grid_get(mainGrid, a ,b) < 100 {
  14.        
  15.         // A second loop to add the blocks to the world for their respective section/collection
  16.         for (blockX = 0 ; blockX < blockGridWidth ; blockX++ ) {
  17.                 for (blockY = 0 ; blockY < blockGridHeight ; blockY++ ) {
  18.                     // if cell value 1 is found, paint a tile or create an object.
  19.                     if  ds_grid_get(roomGrid,blockX,blockY) = true {              
  20.                    
  21.                         // mapGridX and mapGridY is derived from the dungeon layout grid.
  22.                         // This is adding a block at a real world coordinate, here, block is the unique ID of the instance.
  23.                         block = instance_create(
  24.                             (blockX*blockSize)+mapGridX*roomWidth,(blockY*blockSize)+mapGridY*roomHeight,oBlockTemp
  25.                         )
  26.                         solids[ roomNumber, tileNumber ] = block; //Put the block into the solids array for this room
  27.                         ++tileNumber; //Increase the tileNumber so the next block is added to the array after the previous one
  28.    
  29.                         // Here i want to save the id of each block to a list/array/map/collection,
  30.                         // so they belong to their respective section (mapGridX,mapGridY).
  31.                         // I then want to refer to this data structure with the help of -
  32.                         // player.x and player.y
  33.                         // I will use these comparisons to deactivate and activate the -
  34.                         // collection of instances.
  35.                        
  36.                         }
  37.                     }
  38.                 }
  39.            
  40.             }      
  41.  
  42.             ++roomNumber; //This should be increased after each room's blocks are added. I might have got the indentation wrong
  43.    
  44.         }  
  45.  
  46.  
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement