Author Topic: Two color fill (possible)?  (Read 6265 times)

pahe

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
    • View Profile
Two color fill (possible)?
« on: May 16, 2015, 08:29:47 AM »
Hi folks.

I would like to achieve a filled sprite, which should be filled with two different colors (well, actually three 'cause the background should be grey) and I wonder how I can achieve this.

The situation is, that there is an energy cable (without energy) and from both ends could be energy inserted, which then fills the cable with its energy (red from one side, blue from the other side). You can see an example of it in the screenshot, I've done with a normal and two filled sprites, but this leaves some problems.

Has anyone a suggestion how to solve the problem? Maybe the sprites aren't the right solution and I should check out if I can achieve something like that with a shader?

Any help is appreciated!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Two color fill (possible)?
« Reply #1 on: May 22, 2015, 03:30:57 PM »
Yes, I had to do it for Windward. Create several sprites and have a script reposition them / scale them as needed, it's quite trivial and no shader is needed.

pahe

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
    • View Profile
Re: Two color fill (possible)?
« Reply #2 on: May 26, 2015, 04:45:28 AM »
Ok, so a background sprite and two filled sprites (one for both ends). Sounds pretty easy. Thanks!

I also created a shader for this, but that was more a try out :)