Fading With Text

For questions about using Classic.

Post » Thu Jun 25, 2009 3:43 pm

Hey guys - hate having my first post on a forum being one asking for help, but I've been butting my head against a wall for hours trying to work out why something isn't working.

What I am attempting to do is have text appear when the player is overlapping with an object and they press the "x" button. The text is supposed to stay there, and once the player no longer overlaps the object, the text should fade out. This action should be repeatable each time the player overlaps the object (ie they leave that area and come back and press "x" again, it should re-appear, and then fade when they no longer overlap).

Anyway, I can manage to make the text remain when "x" is pressed and they overlap the object, and then using "text>make invisible" I can turn it off when they no longer overlap. But when I change to "text>fade:start", the text immediatley begins fading when "x" is pressed and the player still overlaps the object.

I'll post my current .cap and hopefully someone can figure out what's going on. The most frustrating thing is that I managed to make the fade work properly with an image in another place, yet it doesn't work this time.

Oh, to those looking, the "S" box is the item to overlap and press "X" to see the text. Text3 is the text object related to it which I cannot get to fade when not overlapping. "Shift" is the jump button as well.

Here is the .cap: http://willhostforfood.com/?Action=down ... leid=71924

The version of Construct I'm using is one of the 0.98.x versions, by the way, but the same thing happens in 0.99.3.

Thank you all.
B
3
S
1
G
3
Posts: 14
Reputation: 1,053

Post » Thu Jun 25, 2009 3:57 pm

Mouse is not over object(inverted)
>text set opacity Text.Opacity -1

Mouse is over object
>text set opacity Text.Opacity +1
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Jun 25, 2009 4:22 pm

That's not quite what I want to do there. I can already make the text appear and disappear with a "text>make visible/invisible" event, but what I'm trying to get happening is the fade Behaviour to work when the player isn't overlapping the "S" box, rather than it happening the moment the player overlaps the "S" and presses "x". I mostly want the fade so the rest of the game looks consistant. If what I'm hoping to do can't be done, I guess I'll just have to settle with the visible/invisible events.

EDIT: Apologies, newt, that does do what I'm wanting it to.

Is there no way to do it using the Fade Behaviour though? Not that this solution is bad or anything. I'm just very confused as to why the Fade Behavious isn't working how it seems it should (to me, at least). It's practically doing the same thing as the method you posted me there.

Thank you very much for that.
B
3
S
1
G
3
Posts: 14
Reputation: 1,053

Post » Thu Jun 25, 2009 4:32 pm

Yeah the fade behavior is a bit hard to get right, thats why I generally use my own.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Jun 25, 2009 4:46 pm

Yeah, seems bizzare anyway. Possible bug maybe, or just a quirky behaviour?

Anyway, thank you for that, and now I can get myself off to bed now that my mind won't be puzzling over that any more. >_<
B
3
S
1
G
3
Posts: 14
Reputation: 1,053

Post » Thu Jun 25, 2009 5:51 pm

<preempt Ashley>
I think you mean Text.Opacity + or - (1*timedelta).
</preempt>
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Thu Jun 25, 2009 6:26 pm

[quote="Arima":25m2luga]<preempt Ashley>
I think you mean Text.Opacity + or - (1*timedelta).
</preempt>[/quote:25m2luga]

Ok, sure if the text is moving.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Jun 25, 2009 6:48 pm

[quote="newt":us3cs5it]Ok, sure if the text is moving.[/quote:us3cs5it]

:?

Timedelta isn't just for movement, it's for ensuring that anything you manipulate over time will run at the same speed on different machines. Fading something using timedelta is totally kosher.

Usually for fading stuff though I just use Every X Milliseconds.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jun 25, 2009 10:39 pm

Deadeye's right, anything that changes continually over time needs to use timedelta, including acceleration, rotations, opacity, sound effect volumes (eg. if fading out), effect parameters etc. etc. Otherwise, your opacity based fade is tied to the framerate, and the framerate could be anything. The Fade behavior is, of course, framerate independent.
Scirra Founder
B
359
S
214
G
72
Posts: 22,948
Reputation: 178,532

Post » Fri Jun 26, 2009 1:24 am

I never thought of setting the fade time using TimeDelta, but now it's been mentioned, I see its importance.

So is there any particular reason why using the Fade Behaviour itself didn't seem to be working how you'd imagine it should, or was I just missing something really obvious in my early morning daze?
B
3
S
1
G
3
Posts: 14
Reputation: 1,053

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests