Bethod method for image swapping.

ShaneS429ShaneS429 Member Posts: 77
edited November -1 in Working with GS (Mac)
I am working on a game where I have a grid of colored game pieces. When pieces are pressed, they are "destroyed," and after a few seconds, they will come back as a new piece with a random color.

I am struggling to figure what will be less demanding of the devices.

Since my game will be a 8x8 grid of pieces(64 actors total just for the game pieces, not counting the hud and other actors), I definitely want to lower the cpu and memory usage as much as possible.

So far I have a few ideas of how I could do this.

A: When GamePiece is pressed, Change Image to InactiveGamePiece (which is basically just a white see-thru icon), after 'x' seconds, randomize to a new GamePiece.

B: When GamePiece is pressed, Change Attribute Color (R,G,B) to make it white, after 'x' seconds randomize to a new GamePiece Color.

C: Use the Change Attribute - currentImage (I'm just reading about this now from Fire Maple Games' "Animation Controller DEMO"

Any idea of which way would work best considering I will have an entire grid of 60+ of these actors running through all the same rules?

Comments

  • ShaneS429ShaneS429 Member Posts: 77
    Update: I messed around with FMG's technique from his demo and found it to be super easy to implement and it eliminates so many rules.

    I basically had a piece random a number from 1-6. 1 = red, 2 = orange, and so on.

    Previously I had a rule after rule saying, If Color = 1 - Change Image to RedPiece, Otherwise if Color = 2 - Change Image to OrangePiece.

    Now I just have it randomize a color 1-6 and follow it up with a ChangeAttribute - Self.Image to Color..".png" and it eliminates the need for all those rules.

    So I guess this topic can be closed but it is good reference for anyone else wanting to change images like I am doing.
Sign In or Register to comment.