making a blinking effect

digitalzerodigitalzero Member, BASIC Posts: 639

I have a game that you will be invincible for a minute when u first start the stage.... When you are invincible you blink on and off.... I have a lot of actors that I have to do this for... I have made a game boolean attribute labeled invincible... And I have a index attribute labeled blinking... Now what lol I'm just trying to find the easiest way to do this and make sure the actors alpha color is 1 at the end cause sometimes it does not show up because the alpha color is 0

Comments

  • jigglybeanjigglybean Member Posts: 1,584

    you could do a small 2 frame animation with a rule 'if blinking = true then animate'

    Like Balls? Then click here! We've 100 coming soon

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    Like after the blinking logic ends? What about

    When blinking true> do blinking stuff
    Otherwise> change alpha to 1

    Follow us: Twitter - Website

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    hey @digitalzero,

    what I have done in the past is use a timer and say when blinking is false, every 0.01 seconds change alpha to 1

    or create a rule that says:

    when blinking is false & when self alpha is 0;

    change self.alpha to 1

    just a couple ideas!

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    @digitalzero said:
    I have a game that you will be invincible for a minute when u first start the stage.... When you are invincible you blink on and off.... I have a lot of actors that I have to do this for... I have made a game boolean attribute labeled invincible... And I have a index attribute labeled blinking... Now what lol I'm just trying to find the easiest way to do this and make sure the actors alpha color is 1 at the end cause sometimes it does not show up because the alpha color is 0

    When invincible is true:
    Constrain alpha to 1000*sin( self.Time *2000)
    Otherwise: Change alpha to 1

    . . . . . . . . . .

    Adding or subtracting from the constrain equation changes the ratio of blink on to blink off, leaving like it is means 50:50 blink on blink off, adding increases the amount of on, subtracting increases the amount of off . . . so . . .

    Constrain alpha to 1000*sin( self.Time *2000)-900

    . . . will give you short pulses of visibility, whereas . . .

    Constrain alpha to 1000*sin( self.Time *2000)+900

    . . . will give you short pulses of invisibility.

    . . . . . . . . . . .

    Random blinking: (like a broken neon light) . . .

    400 * sin( self.Time * 2000)+ 576 * cos( self.Time * 768)

  • digitalzerodigitalzero Member, BASIC Posts: 639

    Thanks so much for the suggestions you all... I will give them a shot when I get off of work... Thanks you guys

Sign In or Register to comment.