Help with Lightning effect.

This forum is currently in read-only mode.
From the Asset Store
J-BoB Magic Series LIGHTNING Sound Pack comes with 465 high-quality sound effects
  • Working on a new level for my game, here is a Photoshop of what I'm looking for:

    <img src="" border="0">

    The two "Nebula Lightning" looking things are what I'm after. I want them to randomly connect to the center object... Animate for a few seconds, then go away.

    I looked at this thread:

    achieve this lighning effect

    Which had a nice looking version of lightning by Oppenheimer on the last page. I played around with it a bit, it's hard to adjust to what I'm looking for... It seems to be quite load heavy.

    I was wondering if there might be a plasma version that might work for me. I'm investigating that now, but I was looking for any more ideas to achieve a good looking version of this effect.

    Any thoughts? Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Okay, I've gotten a little futher on this -- but have run into a possible bug... I am changing the color filter on my nebula sprite over time. This expression:

    Sprite.NebulaBlue Set Color filter to: rgb((getred(NebulaBlue.filter)-10*timedelta),getgreen((NebulaBlue.Filter)-10*timedelta),255)

    Works great. I can get it to drop both the red and green values for the sprite's color filter down to 0.... But trying to do the opposite (adding TimeDelta instead of subtracting):

    Sprite Set Color filter to: rgb((getred(NebulaBlue.filter)+10*timedelta),getgreen((NebulaBlue.Filter)+10*timedelta),255)

    Doesn't seem to do anything, the red and green values stay the same. Anyone have any idea what I am missing?


  • The color filter by default is white so adding to white will just clamp to white and do nothing. If you initially set the color filter to blue then adding will have an effect.

  • I completely understand that... But even if the RED variable is set somewhere in the middle, you can subtract from it, but not add. Here is a simple CAP to show my problem:


    <img src="" border="0">

    Am I just be missing something simple here?


  • It appears to be some kind of rounding issue. If you increase the 10 to 100 then it works.

    Ok, now I get it. The rgb() function converts the parameters to integers by basically running floor() on each. With a starting red of 150 then subtracting from that gives a number a bit less than 150 which rounds with floor to 149. But with adding you get a number a bit bigger than 150 which rounds with "floor" to 150. So the red will only increase if you add 1 or more to it at a time.

    A solution is to have a global or private variable to increase/decrease and set the red from that.

  • Cool, thank you. It's nice to understand this stuff!

    I'll just do it with variables instead. Shouldn't be a problem.

    Thanks again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)