Different light colors things differently, so it will be a stronger effect if we color our world for each time of day. In order to convey this effect we are going to use the
.setTint() method on each of our GameObjects.
.setTint() performs a color multiplication effect that changes each pixel in your image consistently, in a way similar to having a colored light cast on it. It’s a lot like looking at the same thing through a pair of sunglasses. When we do this, we can contrast the effect of a strong overhead sun during the afternoon, with, say, a lavender light present in the early morning. At night, we can just make everything a little bit darker.
.setWeather(), we’ve given each time of day a tint color. Let’s apply that tint to all of our GameObjects to adjust the lighting for that time of day!
.setTint() the argument
Now do the same for
And finally let’s administer that tint to
That’s not everything in our game though! Let’s update Codey’s tint too! Use
Lastly, let’s do the platforms. Iterate over the platforms with a for-loop over
gameState.platforms.getChildren() and set the tint for each platform.