So far, the blocks we've placed have been pretty blue. It's time we worked on that. Let's look at an example that places blocks of different colors:
As you can see in the example above, the place
function can optionally accept
a fourth parameter that can be used to change the color of the block. Notice
that the colors can be found attached to the colors
keyword that can also be
imported from ctb
.
I've pre-populated the source pane below with a similar piece of code that goes
through all colors made available on the colors
object. Go ahead and hit run.
We'll see in future lessons that there are a lot more colors that you can use here than the ones specified in the example below. But for now, these should do the job and allow us to have fun with colors!
Doesn't that block of code above look tedious? Don't worry, there is a better way. We'll discover it in future lessons. Stay tuned!
© 2024 Abhin Chhabra | Sitemap