How do I have an object continuously fade out and in?

0 favourites
  • 8 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello Scirra forums!

    I want an object to fade out, then in, continuously on a loop forever till I tell it not to. I want it to happen as soon as the layout starts.

    Can this be done with the fade behavior? If not how can I do it?

    I have added the 'Start fade' and 'restart fade' and this has the desired effect, but this way I don't see how I could get it to go on forever. Also, I can't seem to get it to repeat after the first restart fade anyway. I'm not sure if I will have to use animations? I see there is a loop feature on a system event, not sure if this is a way to do it.

    Thanks!

    Sarah

  • There's many ways to do that, but if you want to use fade behavior then:

    Set Fade in to 1, set fade out to 1, set destroy to no.

    in events add "Sprite| On fade-out finished - > Sprite| Fade: restart fade

  • Wow thank you so much! Seems so simple now. I didn't think to add an event directly for the sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just use sine behavior - opacity.

  • I use opacity with a variable and incrementally count up and down as required... Then compare that variable to start it or stop it at the exact time I want...

    Works well with scaling - One thing I did recently was to make a health icon, shaped like a heart and sort of beats like one too...

  • I would use an animation for this. The calculations for continually running a fade behavior is cumbersome to a mobile device. If you aren't targeting mobile then never mind.

  • Tekniko

    I'm doing this for a project at uni which is about creating a UI for a mobile game, so it will never be truly implemented so it doesn't really matter.

    maxxscape & A0Nasser

    About this opacity with a variable - I am very new to Construct so I'm quite lost in your explanations.

    Edit: I was playing around with a variable and opacity but I don't really get how I can use it to fade. If you set opacity from 0 to 100 doesn't that mean I'll have to set it to every number all the way from 0 to 100? :S

  • This shows scaling but it would work the same with opacity... Might not be the best way, or even the right way but it worked for what I was looking for at the time

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