Blinking tint change upon collision with another sprite

I was able to figure out how to have some text continuously blinking different colors.

I thought using most of the same “code” actions would do the same to the main character’s sprite just for 1 cycle when he hits a power up sprite, but I am not sure why it isn’t working.

I want it to turn from it’s regular colors to tinted blue, back to normal, blue, and back to normal.
I’ve tried the above actions both with and without “at the beginning: Reset timer” Either way, it doesn’t work.

Here:


Whenever the timer is greater than 0.2 second, it adds tint to the Main Char. Its fine but after the timer is greater than 0.4 second, it changes the tint again but the timer is also greater than 0.2 second so it changes the tint again. Basically, they are collide with each other.

If I am correct, a good way to solve this problem would be to use Trigger Once in all these events


and not on this event.

If you want this action
image
to only get triggered once when the blue collides with Main Char than add this action to a sub event and add Trigger Once in that sub event.

I am not sure I understood what you meant. Here’s what I think you meant:

But it is still not working. RIght now it looks like the sprite never changes tint at all.

I think with that code it can works.

Why you are using the condiction The hight’s scale of Mainchar < 2?

Edit: I changed a little the code for the colision change the color instantly after the collision and don’t need wait 0.2 seconds to do this.

Thanks. I tried it, but it turned the player blue and left them that way. I want it to blink from normal to blue, then back to normal.

How do I get it to turn off the tint I thought making the tint white would put it back to normal, so I tried ending with that, but it’s still blue.

I tested my example again and it’s works normaly. The Mainchar change from blue to normal color at speed 0.2 seconds. I don’t know why your MainChar stay on blue forever like you said. Probably you make something different. Show your code here for I can see how you made.

I think it’s because you used quotation marks in your variable.

Remove than and test.

Oh! Thanks for catching that.

Now it blinks blue, like I would like, but it never stops. How do I get it to just do one cycle and then stop until it collides with that object again?

When you reset the timer in the last event, also set the object variable tint of MainChar to false.

1 Like

Thanks, I did that, but it keeps blinking even after it is no longer in collision with the other sprite. How do I get it to stop? I would have thought that the setting it to “false” would have done that.

You put quotation marks again. Remove it

Oh man! Haha. I need to add checking for quotes to my list of things like, “Did you use a capital letter when you were not supposed to, or visa versa?”.

My propensity for typos and being bad at catching them may be my biggest hurdle in learning how to code.

After fixing the quotes, it stayed blue, so I added one more action to turn it back to normal color. Now it works great. Thanks!

1 Like