In this chapter, you’ll write code to create a spectacular fireworks show in Minecraft. You’ll learn about ScriptCraft’s built-in fireworks module and the setTimeout() function, and you’ll use a powerful programming technique called recursion. You’ll begin by writing code to launch a single firework after a delay of two seconds and then build on that code to launch many fireworks.
ScriptCraft includes a fireworks module that can be used to launch a single firework at a given location. You can use the fireworks module directly at the in-game command prompt like this:
/js var fireworks = require('fireworks')/js fireworks.firework( self.location )
The fireworks ...