Change actor color based on actor destroyed?

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
I've created a white score actor that says "+75".

I would like for when a blue block is destroyed for the "+75" to change to the blue color. If a green block is destroyed I want the "+75" to change to a green color.

When a block is destroyed the block Spawns Actor, and the "+75" has a behavior to interpolate to where the score is (nice little feature there for added flare).

Whats the best way to accomplish changing the color of the flying score to the color of the brick without having to create a bunch of different colored actors manually? (I thought about having a game.attribute of game.blockdestroyed, so if blue is destroyed it changes to 1, then on the flying actor if game.blockdestroyed = 1, then change self.red/green/blue to the color that I want. BUT, I have features in the game that blow-up multiple bricks and even multiple colored bricks so this wouldn't work...

Is there anyway to have the spawned actor reference the actor that was immediately destroyed (I don't actually destroy it, I recycle it)...

This is a tough one, hopefully someone has an answer. Thanks!

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi again, this would be done quite easily with 1 integer attribute; let's call it ColourGo. When an actor is destroyed, just before the Destroy Behavior, change attribute to 1, let's say, if it's green; 2 if it's Red, etc. Then in your actor that displays the +75, put rules one after the other, when ColourGo = 1 change attribute Color to the correct RGB, when ColourGo = 2, etc. That's pretty much what you've suggested anyway: as for the multiple blocks, I guess you'll have to make a decision that this is a different "animal" and so in those instances, maybe use changing the attribute to 1,2,3,4, 1,2,3,4 on Timers, i.e flashing a rainbow of colours with reference to the different coloured blocks destroyed at once. Think you'd be happy with that?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.