Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

Instantiating game objects in spiral pattern

$
0
0
I am trying to create grid tiles for a system in my game and without the proper algorithm right now it just starts spawning them from the bottom left side. for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { Transform tile = Instantiate(this.tile.transform, new Vector2(x, y), Quaternion.identity); tile.parent = transform; } } How can I make them spawn like this: ![alt text][1] [1]: https://i.stack.imgur.com/kjR4H.png

Viewing all articles
Browse latest Browse all 184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>