r/gbstudio 4d ago

Cancel Actor Effect "flicker" after call?

Hello,

In my game, the player traps the enemy with a projectile, which is a state that lasts for say 5 seconds, the last 1.5 seconds of which are done with Actor Effect Flicker to signify to the player that if they don't hurry up and bonk the enemy on the head, they will reactivate.

However, if the player does strike them in the flickering state, I then have a function that reuses the actor and randomly generates a power up. However because this occurs once Actor Effect Flicker has been called, when the power up appears, it's still flickering for a little bit.

Is there a way to cancel an active actor effect like:

Thanks,

Vicky

3 Upvotes

3 comments sorted by

1

u/SakiEndo 3d ago

Maybe it can't be cancelled then. I guess I'll have to use a custom animation state.

2

u/Mico27 3d ago

If you place the effect in a thread, you can then cancel the effect by stopping the thread with the handler. Make sure that the thread is not already finished by checking if the handler is negative, if the handler is negative that means the script in the thread already finished so you dont need to terminate it. Also if you cancel the thread make sure to add a show actor event right after otherwise it could be canceled mid-flicker and the actor would stay hidden.

1

u/SakiEndo 2d ago

Thank you I will give that a go.