Color Inheritance
OrchestralMonkey
Member Posts: 33
How do I have an actor inherit the color of another actor when clicked?
--Lee
--Lee
Comments
If you're working with a limited number of colors, you can use "codes" to represent each color and rule to determine what color is needed. Kind of like:
If colorCode = 1
red = some value
green = some value
blue = some value
If colorCode = 2
red = some value
green = some value
blue = some value
Etc
If actor1 is touched then change actor1's color to actor2's and also change actor2's color to actor1's.
Hope that clears it up, if not let me know.
My original train of thought was this:
If actor1 is touched then 'Change Attribute' self.Color.Red = actor2.Color.Red (and repeat for green and blue values), but I couldn't get that to work (unless I did something wrong).
But again, the above will only work at the scene level, not on prototype actors. To switch colors using prototypes, you need to use the above method I mentioned, storing color values in game-level attributes.
States:
0 - Nothing Selected
1 - One actor selected
2 - Second Actor Selected
Here is the demo:
http://gamesalad.com/game/play/88574
The only thing it looks like I'd need to change is to have the swap occur immediately when one actor is touched instead the swap happening when the second actor is touched.
I only have three actors (left, middle, right) so whatever the color of the middle is, that is what gets swapped with either the left or right when either of them (left or right) is touched. The left and right actors are active the middle actor is just a container if that makes sense.
Still at http://gamesalad.com/game/play/88574
Thank you so much for the demo. This is exactly what I was trying to achieve. Thank you again.
--Lee