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

Which loop is best to find specific game objects in an array?

$
0
0
I’m recreating an old crash bash pogo game; I have 64 tiles in an array and they each have different materials attached to them allowing them to change to a players colour when collided with but now I’ve got a points banking box that needs to loop through all 64 tiles to find which tiles have a specific colour material attached so it can allocate the points to that player or enemy. I’ve been trying a foreach loop to find and name each tile with a players material colour but using that one is causing all 64 tiles to turn that players colour rather than just name the ones that are currently the players colour. Should I be using a different loop or introduce a break clause somehow? Any help is appreciated.

Viewing all articles
Browse latest Browse all 184

Trending Articles



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