Help with Lightning effect.

For questions about using Classic.

Post » Wed Dec 18, 2013 1:15 pm

Working on a new level for my game, here is a Photoshop of what I'm looking for:



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!
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Fri Dec 20, 2013 12:05 pm

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?

Thanks.BluepointVance2013-12-20 12:06:23
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Fri Dec 20, 2013 8:10 pm

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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sat Dec 21, 2013 3:25 am

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:

RGB FILTER PROBLEM EXAMPLE CAP DOWNLOAD LINK





Am I just be missing something simple here?

Thanks!BluepointVance2013-12-21 03:26:34
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Mon Dec 23, 2013 4:49 am

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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Mon Dec 23, 2013 10:13 am

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.
B
4
S
1
G
2
Posts: 64
Reputation: 980


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests