Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mapGridX.Y are positions in a dungeon layout called mainGrid.
- solids = [0, 0]; //Create the array to store all the blocks
- roomNumber = 0; //tracks which roomNumber we're in
- for (mapGridX = 0 ; mapGridX < ; gridW ; mapGridX++) {
- for(mapGridY = mapGridY ; mapGridY < ; gridH ; mapGridY++) {
- tileIndex = 0;
- // If i find a value less than 100 i populate with a specific layout,
- // the addition of layouts to below mentioned roomGrid is cut out
- if ds_grid_get(mainGrid, a ,b) < 100 {
- // A second loop to add the blocks to the world for their respective section/collection
- for (blockX = 0 ; blockX < blockGridWidth ; blockX++ ) {
- for (blockY = 0 ; blockY < blockGridHeight ; blockY++ ) {
- // if cell value 1 is found, paint a tile or create an object.
- if ds_grid_get(roomGrid,blockX,blockY) = true {
- // mapGridX and mapGridY is derived from the dungeon layout grid.
- // This is adding a block at a real world coordinate, here, block is the unique ID of the instance.
- block = instance_create(
- (blockX*blockSize)+mapGridX*roomWidth,(blockY*blockSize)+mapGridY*roomHeight,oBlockTemp
- )
- solids[ roomNumber, tileNumber ] = block; //Put the block into the solids array for this room
- ++tileNumber; //Increase the tileNumber so the next block is added to the array after the previous one
- // Here i want to save the id of each block to a list/array/map/collection,
- // so they belong to their respective section (mapGridX,mapGridY).
- // I then want to refer to this data structure with the help of -
- // player.x and player.y
- // I will use these comparisons to deactivate and activate the -
- // collection of instances.
- }
- }
- }
- }
- ++roomNumber; //This should be increased after each room's blocks are added. I might have got the indentation wrong
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement