Repeated fading object.

For questions about using Classic.

Post » Tue Dec 23, 2008 6:37 pm

I'm sure this is a total noob question, but anyway... If we use the health text in the ghost shooter tutorial as an example, what would be the best way of making that text fade in and out upon receiving damage. I've tried various methods using the fade behaviour, but I can't seem to get the text to come back after the first time it shows.
I'd also like the text, when it becomes visible, to be located over the main player sprite. I'm sure I could figure out how to do THAT easily enough, but it probably wouldn't be very efficient.

Thanks for your help. :D
B
2
G
4
Posts: 40
Reputation: 1,130

Post » Tue Dec 23, 2008 6:50 pm

Hi, I haven't seen the ghost hunter tutorial in ages, but my guess is a text appears on screen, indicating you've taken damage, then fades?

When the damage occurs: System: Create object "fadetext" at (middle of screen)
fadetext fadeout is finished- destroy fadetext

that should suffice I suppose (?)
lol
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Tue Dec 23, 2008 7:03 pm

Ah, I just tried it and you can't run a fade again once the fade finishes. That's fixed in the next build - use the 'Start' action in the Fade behavior to run the fade again. Also, make sure 'Destroy afterwards' is unticked in Fade properties! For now, you could do as midnight suggests and create separate objects.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Tue Dec 23, 2008 7:40 pm

Okay, thanks so much to both of you! I'll do my best, and it's great to hear these little updates that can be expected in the next version. ;)

Edit: Works well enough guys. Thanks again.
B
2
G
4
Posts: 40
Reputation: 1,130

Post » Mon Jan 05, 2009 3:50 pm

how would i have 2 blue glowing dots on 2 different image points, fade in and out all the time? can't seem to do it in a proper way.
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Mon Jan 05, 2009 5:24 pm

[quote="zephyrus":3s621hjm]how would i have 2 blue glowing dots on 2 different image points, fade in and out all the time? can't seem to do it in a proper way.[/quote:3s621hjm]

That can be easily achieved using some simple maths. In an "Always" event, set the opacity of the objects to this:

50 + sin(timer / 4) * 50

Changing the 4 changes the speed. A higher number is slower and a lower number is faster. Hope that helps.

By the way, I suggest adding the ability to change the opacity of an object to the Sine behavior.
Moderator
B
98
S
36
G
19
Posts: 1,584
Reputation: 17,717

Post » Mon Jan 05, 2009 9:15 pm

[quote="linkman2004":22doi361][quote="zephyrus":22doi361]how would i have 2 blue glowing dots on 2 different image points, fade in and out all the time? can't seem to do it in a proper way.[/quote:22doi361]

That can be easily achieved using some simple maths. In an "Always" event, set the opacity of the objects to this:

50 + sin(timer / 4) * 50

Changing the 4 changes the speed. A higher number is slower and a lower number is faster. Hope that helps.

By the way, I suggest adding the ability to change the opacity of an object to the Sine behavior.[/quote:22doi361]
i just realized that a simple "fade" behaviour did the trick. thanks anyway!:)
B
2
G
4
Posts: 43
Reputation: 1,136


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests