How to change a characters state

Hi guys, totally new to this but I've finished the 2D tutorial and I'm stumped with this idea I have. I'm looking to make a game where the character is capable of changing colour to destroy coloured blocks.

So for example if the character is standing on a red block by turning red the block would vanish.

I've no idea where to even start with this as mentioned at the start I'm totally new and have never done any coding or scripting before.

Thanks for any replies :)

As always, break it down into simpler problems until you get to something you can solve. (Especially if you're a beginner at programming.)

For what you described, a good start might be figuring out how to change the color of the player (maybe just in response to key presses for testing purposes). There's a few ways this can be done; for example, you could modify the Material.color property or a specific color associated with the shader, or swap the current material out for another one (the latter might be a bit easier).

As for determining whether the player has collided with a block of the same color, I'd probably create a ColorTag component with an enum indicating the current color of the object. Then, when a collision occurs (or whatever), you can check the colors of the two objects to see if they're the same. (IMO it'd be better to do it this way than to try to compare actual materials or material colors, as it'll give you more flexibility as far as the visuals are concerned.)

If you run into problems or have more specific questions, you can edit your post here, create a new question, or post to the forums.

As Jesse said, break it down...

I suggest taking a look at iTween, it has a toColor function, and you can put that on either a blank white material, or you can put a light around the player... Either way would work...

And then you can compare the color with others, and if its ==, than it'll Destroy(); the object...

For iTween:

Visual iTween (Download both to use):

Hope it helps!