fade in - fade out on passing event point

0 favourites
  • 10 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Here is my solution for an info text fading in and out on passing by an infopoint in game.

    <img src="http://www.tastybytes.de/jpgs/2012/01/fade.jpg" border="0">

    Perhaps its usefull for someone:


  • sorry but there is a simpler way!

    <img src="http://dl.dropbox.com/u/53374990/fade.png" border="0" />

    [edit] just realised the 'trigger once' isn't necessary.. also needs dt

  • Fade in, fade out

    Multi-implementations are cool <img src="smileys/smiley1.gif" border="0" align="middle">

  • in two events yeah


  • I was so proud of finding a solution for that. Now I feel stupid. You guys are great!

    btw: When do you sleep?

  • in two events yeah :D


    Yann - I see your code, but I dont understand why this fades so smooth. Can you explaine you two lines a bit for stupid little me? Please!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • between 00h34 and 00h43 why ?

  • Weishaupt

    if the player overlap the sprite, every tick you do a lerp(currentOpacity, 100, 5*dt)

    (forget the min and max function they are useless... just to scare some n00bs)

    basically while you are overlapping the sprite, every tick you travel a little percentage of the distance between your current Opacity and 100.

    But this percentage is fixed and is equal to 5*dt.

    So as the distance decrease, the same fraction of this distance decrease, so you basically ease in the value

    the primary goal of lerp() isn't to be used like that. You usually have a starting point, an end point and a percentage (from 0 to 1)

    so you usually do lerp(start,end,percent) and you make the percent value evolve to create movement.

    But here the percent is fixed and you apply the result of the lerp to the start value, so the distance between start and end decrease... etc I explained that already.

    And you do exaclty the same when you don't overlap. But toward 0 instead of 100

  • That's pretty awesome. I was just about to need something like this for explaining controls as you move around, and to make the storyline happen.

    Question though. Is there a way to have this work when passing different instances of an object, such as multiple signs, to have it say different things without using a separate event for each one? This of course ties back into my lack of understanding with instances, and desire to learn them.

  • Yann - Thanks pal!

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