Highlight a Location

To prepare for next lesson Mouse Click Events, we'll learn to call another function in CodeCraft, this function can highlight mouse locations where you'll later perform actions in the 3D game world.

Please type in this function:

game.highlight("air");

Here, the string "air" means "empty block". This function highlights the empty location adjacent to a solid surface where the mouse points to.

Click 'run' and enter the CodeCraft world. Move the mouse around, you'll notice sometimes when the mouse is next to a solid block, the highlighted lines show the adjacent "air" block.

This function helps you see the mouse location where you are going to perform some magic, such as building a wall, a fancy flower or even a giant castle on mouse clicks.

Yes, in CodeCraft you have the power to build anything! To get a glance at this magic, let's continue.

results matching ""

    No results matching ""