Can anyone help with Object Recolorizer extension?

I’m building a chain reaction game, and I’m using the Object Recolorizer extension to change the colors of my sprockets when they collide. I had it working fine when they just changed colors one time, but now I’m trying to make it so that they change to a target color in phases. They start as blue, then when they collide the first time, they turn to purple, and then they turn full red when colliding the second time.

It’s partially working right now, as they do change color with the first collision. I just can’t get them to do the second change to full red on the second collision. I’ve set an instance variable that tracks which color the sprocket currently is, and when it changes color the first time, the instance variable is updated so the game will know to trigger the second color change the next time it’s hit.

Here is my variable and my events:

Any help would be greatly appreciated.

Thanks.

Hi Nicronon

Firstly, wow, I’m so glad you asked this question because I didn’t know about this extension and it will solve a big problem that’s made me not want to work on my game. Yayyyy.

So, I did a test with your events. When I used your events it changed to the second color straight away without showing the first color change. But your problem was the opposite, it only showed the first change and a second collision did nothing.

My problem was because the object wasn’t moving away from the collision quick enough and the variable was changing from 0 to 1 to 2 in an instant and so it looked like it was changing to the second color straight away.

I moved your wait 1 second up and changed it to 3 seconds so the object would have time to move away from the collision before the variable changed. This was to test it and I’m sure there are better ways of doing it.

Oh, wow, I’m so happy to hear you can solve your problem with that extension, Bubble. Onward and upward, don’t give up!

I was actually probably taking too long when I used the one-second timer. My sprockets hit back and forth pretty quick.

I’ll mess around with it and see what happens.

I’m not sure the wait is doing anything. A wait puts a wait or a pause where it is but only for actions after it within the same event or sub events of it. Everything else continues to be executed including the wait if it’s still reachable through a condition. As is it adds a wait but there’s nothing below it to run.

If you moved the wait up a spot it would add a wait for 1 second and then change the color variable to 1. The only issue is that if it was still zero then that event would still trigger for the next second while it’s condition was still true. It would create a sort of buffer or stack of waits that will all start to expire and unpause in the same location and repeatedly set the color variable to 1.

You could use a trigger once below where the variable is 0 condition so it would only trigger once. It will still trigger later after the variable changes to another number and the back to 0.

https://wiki.gdevelop.io/gdevelop5/all-features/timers-and-time/wait-action/#a-basic-example-introduce-a-wait-before-another-action

I’m not a fan of the wait action. There are more precise ways of doing things. I’m not saying it’s not ideal for some things. I’m just saying, be careful. As long as you prevent the wait from continentally being triggered. It should be fine.

2 Likes