Why can't I create a color Game Atribute?

runimals

  • Posts: 215
I need different actors to access a color attribute, but the only way I know would be the attribute to be a Game Atribute. But Game Atributes can only be number, boolean, list or text...

Maybe I can use any of these Game Atributes as a color?

Tuo

  • *
  • Posts: 2469
You can store anything you want inside of a list, so try storing the colors as different elements in a game attribute list and then retrieve those colors when you need them.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Hectate

  • *
  • Posts: 4643
I'm pretty sure colors are just hexidecimal numbers internally, maybe store it as a number and convert it back to a color with a code block somewhere?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

runimals

  • Posts: 215
I've never used a code block before, could I see an example?

Thanks!

flyingninja77

  • Posts: 30
You could also store it as a text value and use an "If [color] = Red (text) Set color to Red".  This would obviously have to be put under a "When Drawing" block, but if you only needed one color, you could use that method.  If you needed to store lots of colors, I would use a list and follow a similar method.

Hectate

  • *
  • Posts: 4643
I've never used a code block before, could I see an example?

Thanks!
Found under Flow > Advanced:

http://static.stencyl.com/pedia2/blocks/flow/flow_advanced/Code.html

It just passes whatever the contents of that block are without any change. You'd have to look up some information on how colors are stored - either in the Flash API or Haxe API depending on 2.x or 3.0.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

runimals

  • Posts: 215
Thanks guys! I'll try which of both methods is the best for my reduced programming skills.