Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Fill(int indexX, int indexY)
- {
- Queue<Tile> queue = new Queue<Tile>();
- //get the tile they clicked on and add to queue
- Tile clickedTile = map[indexX, indexY];
- queue.Enqueue(clickedTile);
- //variables to check against map dimensions
- int x = indexX;
- int y = indexY;
- while(queue.Count != 0)
- {
- Tile temp = new Tile();
- //gets first item in queue and removes it
- temp = queue.Dequeue();
- //find this item & update the selected picture coords
- for(int i = 0; i < map.GetLength(0); i++)
- {
- for(int j = 0; j < map.GetLength(1); j++)
- {
- if(map[i,j].)
- }
- }
- //add all adjacent tiles to the queue
- //to the right
- x = indexX + 1;
- if(x < map.GetLength(0) && x >= 0 && y < map.GetLength(1) && y >= 0)
- {
- queue.Enqueue()
- }
- //to the left
- x = indexX - 1;
- //down one
- y = indexY + 1;
- x = indexX;
- //up one
- y = indexY - 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement