Flashing actor doesn't work


  • Posts: 21

I almost feel bad asking this since the problem is likely very simple, but I haven't solved it.
I want to make an actor flash when respawned. My code is:

repeat n times
    fade last created Actor to 0% over 0 sec using none
    do after s seconds
        fade last created Actor to 100% over 0 sec using none

I've attached the whole respawn event. It creates the player in the center of the screen, makes it temporarily invulnerable, and is supposed to flash the player.


  • Posts: 293
i think a repeat loop will run over and over and not stop with a timed event.. so you wont see a flash until the last loop.

I would make an actor block, attach to that actor that you can call, that has a timer event in it, that does the flashing for you, and call it once.

So i would create an Actor block that has a do every section in it, and pass in a number (time) to flash for
So the actor flashes using its only behaviour..

Maybe have a behaviour that is disabled, and activate that behaviour when you need it to flash, then disable the behaviour when you want it to stop. Something along those lines..


  • Posts: 1115
Move the flashing to a When  Created event for the actor. Then you donĀ“t have to control it further as it happens only once.
And I try to avoid sticking too much in a When killed event.


  • Posts: 2262
Why not create it as an animation? That animation will play on spawn, and then change it to the default animation after however long you want.


  • Posts: 21
Thanks for your help. I combined noxtudio's and gplar's solutions.

I created a Behavior for flashing:
Do every X seconds
    fade in
    do after y seconds
        fade out

Then I attached this Behavior to the Actor. In a When Created block, I enable that behavior then disable it after a few seconds. I also use  Boolean so it only flashes after a respawn, not the initial spawn. Works well and this way I can easily invoke the Flash behavior from any event. Its timing variables are hard coded for now but I'm sure there's a way any calling code can pass in values for them. This way the flashing behavior can be event-specific.

I wonder if there is a bug lurking here: suppose you aren't careful with your timing and the Flash behavior is disabled during a fade in/out or in between fade out and fade in? Will you be stuck with a half-transparent or invisible Actor?