How do I do a breathing sprite brightness effect

Get help using Construct 2

Post » Tue Sep 05, 2017 3:02 am

Hi! what I'm trying to do is a text image changes it brightness to 0 and then when it reach 0% go back again to 100% and again the same thing, to 0% , like a breathing effect. I added to the sprite an instance variable for control the brightness, I saw this in a project sample on construct 3.
Image

Anyone can help me with this?

Thank you!
B
33
S
11
G
3
Posts: 28
Reputation: 4,409

Post » Tue Sep 05, 2017 4:34 am

Use Sine behavior, it's very easy. Set it up with the following parameters:
Movement: Value
Magnitude: 100

In your event sheet add the following:
Code: Select all
System -> On Every Tick -> press_start Set Effect "Brightness" parameter 0 to self.Sine.Value


Why are you changing brightness? When I need a similar effect in my game, I usually change Opacity. In this case, you simply set Movement: Opacity in the Sine plugin and that's it, no programming required.

Or if you need more advanced settings (nicer breathing effect), download and install LiteTween behavior, I highly recommend it.
Check out my awesome game Doptrix
B
17
S
8
G
9
Posts: 188
Reputation: 6,365

Post » Tue Sep 05, 2017 4:40 am

Nearly always behaviors can do all the basics.

Just add a sine behavior to it, set it to value only and use that value for the brightness amount, like this:

Image

...and then...

Image

If you want it to not stay dark for half the cycle just set the Magnitude to 50 instead of 100 and then in the event make it Sprite.Sine.Value+50

Edit: dop2000 beat me to it, fair and square :)
B
6
S
1
G
1
Posts: 14
Reputation: 883

Post » Tue Sep 05, 2017 4:12 pm

Thank you both! I didn't know I could use sine behavior to do that, I thought that behaviour was just for movements, I'm still learning :P

@dop2000 I'm changing the brightness because I don't want the sprite disappear, just want it to go black and the return to it color.
@ydobemos thanks for the tip of add +50 in the event.
B
33
S
11
G
3
Posts: 28
Reputation: 4,409


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, mihirolover, namaewayukidesu and 15 guests