So, I’ve finished this game and I’m trying to juice it up even further by watching the recommended video at the very end of the chapter (Ray Wenderlich - Adding Juice to your Games - YouTube).
I’m trying to reproduce flashing (minute 12:45 of the video), where the node turns white for a brief moment when the player touches it, but I’m having some trouble figuring out the best way to do it. Does anyone know how?
At first, silly me, I tried colorizing it with white, but that obviously doesn’t work since it basically means “do nothing”.
I’ve read that one way to do it is by having a white texture version of the node and changing it at runtime, but I find a bit cumbersome having second textures for all the sprites, plus that wouldn’t work well with animated nodes, such as the player.
So, the only way I managed to make it work somehow was with a custom shader, basically making all the non-alpha pixels white and then deleting the shader after a brief moment, but I think this is a pretty heavy task for something that should be pretty simple, plus I’m not very familiarized with shaders, so I don’t really know how to make it fade out so that the node fades from white to the original sprite color instead of abruptly going from white to the original color.
If anyone could enlighten me in how to make it work, I’d be very grateful.
Basically and to sum it up, I’d like to know how to make something like this work with a white color. If instead of white it was red, yellow or anything else, this’d be all the code required to make it work, but it gets tricky for white.
color = .white colorBlendFactor = 1 run(SKAction.colorize(withColorBlendFactor: 0, duration: 0.5))