- Home /
How to count red colored tiles on my floor?
Hello,
My game is 2D. I have a flor made out of arond 800 black colored tiles. When player1 moves over them they change to red. How do I count the number of tiles that have been red-colored out of the whole floor?
I found this question, but I do not know how to convert it to C# and if it works for my intention.
you're already changing colors to red, why don't you just count the changes to red?
I had it like that before, but I have added a ho$$anonymous$$g missile-power up (the grey object) that when picked follows the enemy and if you kill it, it colors the floor. Because I never know the amount of tiles colored with the missile I thought I could count the tiles more efficiently.
and how do you color tiles if you don't know which ones because then you would be able to count them?
Answer by ScareCrow95 · Dec 15, 2018 at 10:30 PM
There are several ways you can do this, Why not just increment an integer everytime you change the color to red? and before changing the color to red you can check - If(isColorRed) if it is red ignore it otherwise its a black tile and increment the counter
Your answer
Follow this Question
Related Questions
bounds checking a list? 2 Answers
Changing the material in an array of materials at run time 2 Answers
Convert 2D array to a 1D array 2 Answers
Color Array in C# 1 Answer
Get size of a vector3 array c# 1 Answer