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

Can i restart my for loop from 0

$
0
0
Is it possible to restart my for loop under a certain condition? What im trying to accomplish is getting a tile that is not on the border of the map using a for loop but for some reason it is still placing the tile on the border. I thought it had something to do with the for loop not looking through the previous border index in the list, hence why i wanted it to start from 0 again. here is my code: for(int s = 0; s < borders.Count; s++){ if(start != borders[s]){ Debug.Log("Placing start tile at " + start); } else if(start == borders[s]){ start = Random.Range(0,tiles.Count); } } Also i would like to note, there is nothing wrong with the borders because i checked what all the tiles in the border list were and the match perfectly with the outside of the map.

Viewing all articles
Browse latest Browse all 184

Trending Articles



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