How do I // gradual opacity on event

  • I am trying to make a sprite become visible when the player sprite overlaps another sprite to provide contextual help:

    If the player sprite overlaps a door sprite, a sprite which says "press e" should fade in, once the player's sprite stops overlapping the door, the "press e" sprite should fade out.

    how do i achieve this?

    thanks in advance.

  • I am trying to make a sprite become visible when the player sprite overlaps another sprite to provide contextual help:

    If the player sprite overlaps a door sprite, a sprite which says "press e" should fade in, once the player's sprite stops overlapping the door, the "press e" sprite should fade out.

    how do i achieve this?

    thanks in advance.

    use the Fade behaviour with "destroy after fadeout" option disabled

  • well, i figured that would at least make the sprite persistent. I just don't know how to set it up so the overlap triggers the fade in event and the opposite to trigger the fade out event. there is no setting to determine the initial state of the fade. as far as i can see. I'm thinking about using lunarray litetween to make the opacity go from 0 to 100 on overlap and viceversa once the sprites stop overlapping

  • sorted it: on overlap: create object where i needed it, set fade in time, start fade. once sprites stop overlapping: set fade out time, destroy after fade out.

  • well now there's the tiny problem that the sprite needs to stay visible for as long as the sprites are overlapping and the fade behavior has a mandatory set wait time which can be 0 or x seconds, I need the sprites to stay visible for as long as the overlap lasts and there is no way of knowing that time.

  • Your wait time is 0. You can set the fade behavior active or inactive. As long as it is inactive it will not fade. (Use the start fade action)

  • how do i get control of the fade behavior's active /inactive through events? I only see it in the behavior properties. in the fade i only get restart fade, start fade, set fade in counter, set wait time and set fade out counter

  • Start fade

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok, this is the behavior i saw when i did that: start fade triggers the fade in, with 0 as the value for the wait time it goes straight into fade out. what i need is for it to stay at full opacity indefinitely until the player moves away from the trigger sprite and then fade out

  • I see what you mean now.

    Try adding 2 fade behaviors. The first one can be called "fadeIn". Fade in time x, wait time 0, fade out time 0. This one is responsible for fading in only.

    Second one "fadeOut" with fade in time 0, wait time 0, and fade out time x.

    You can use each of these individually by using the restart fade on the correct one when your mouse over/mouse out conditions are met (remember to add trigger once).

  • that sounds like it will do. I'll give that a shot, thanks for the patience.

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