Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Alpha color woes  (Read 3561 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Alpha color woes
« on: March 20, 2010, 04:27:32 PM »

Hi muties,

I'd like to ask for an advice. I am currently in the process of redesigning game interface and the new interface uses a lot of semitransparent elements with opacity animation. As "windows" are quite limited in WME, I have an extra GUI layer I include in every scene using this interface. So far good. But I am facing the following problem: I'd like to preset AlphaColor to value lower than 255.

Things I've tried:

1, (currently implemented) in scene_init.script I include special universal file which manually sets the individual opacity. This method is very clumsy and the only way how to test the opacity levels is through constant compile'n'test.

2, creating a sprite with one frame for each element - this method in theory works, but as soon as sprite is assigned to entity, you can't no longer simply set opacity through AlphaColor. You have to for every entity query SpriteObject, Frame and Subframe to finally assign the opacity. Since WME has no decent nesting, it's too ugly.

3, I tried using custom attribute and set AlphaColor there. This is totally weird - as soon as you put as custom attribute known object parameter, it attempts to be set (Scale for example) but you never again get to this information apart from the .scene file. Scale works (the object changes size), but AlphaColor doesn't.

4, I considered using custom Attribute (alpha eg.) and then writing universal loop which would attempt to set these values by looping through all Scene entities. As some of the scenes are entity heavy, I've decided against it.

Any other ideas?

Thanks!
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Alpha color woes
« Reply #1 on: March 21, 2010, 11:09:22 AM »

I've found out the way of the compromise actually based on no. 4.

I put custom attribute (Alpha) to nodes in the layer called GUI, then I use something like this:

Code: WME Script
  1.  
  2. var layer = Scene.GetLayer("GUI");
  3. var numNodes = layer.NumNodes;
  4.  
  5. for (var loop=0;loop<numNodes;loop = loop + 1)
  6. {
  7.    var ent = layer.GetNode(loop);
  8.    if (ent.Alpha != null) ent.AlphaColor = MakeRGBA(255,255,255, ent.Alpha);
  9. }
  10.  

seems to me as the most elegant way.
 
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.023 seconds with 25 queries.