Roller Coaster

Build your own Roller Coaster @showdialog

Learn how to use an extension to build your own 🎢 roller coaster 🎢 in Minecraft. For this tutorial, it’s recommended to be in a flat world.

A MakeCode extension is a custom set of blocks that you can use to extend the functionality of the existing blocks in the Toolbox. Learn more about extensions here.

Roller Coaster

Add the Roller Coaster extension @showdialog

In this tutorial, the Roller Coaster category is already added for you. If you want to build your own roller coaster project, select the Extensions category in the Toolbox, and click on the Roller Coaster Builder extension in the gallery.

Extensions

Extension card for RCB

Rename chat command

In the ||player:on chat command|| block on the workspace, click to rename this command from “run” to “build”. We’ll use this command to start building our roller coaster.

player.onChat("build", function () {

})

Begin track

From the ||rollerCoasterBuilder:Roller Coaster|| category, drag a ||rollerCoasterBuilder:begin track|| block out and drop it in the ||player:on chat command|| block.

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
})

Add a straight line and turn

From the ||rollerCoasterBuilder:Roller Coaster|| Toolbox drawer, drag out an ||rollerCoasterBuilder:add straight line|| block and drop after ||rollerCoasterBuilder:begin track||. Then drag out an ||rollerCoasterBuilder:add left turn|| block and drop it at the end.

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.addTurn(LEFT_TURN)
})

Create ramps

Now let’s add some height! From the ||rollerCoasterBuilder:Roller Coaster|| category, drag out 2 ||rollerCoasterBuilder:add ramp up|| blocks and drop them both at the end of our ||player:on chat command|| block. In the second ||rollerCoasterBuilder:add ramp up|| block, use the drop-down menu to change “up” to “down”.

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.addTurn(LEFT_TURN)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Up, 10)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Down, 10)
})

Add spiral and free fall

From the ||rollerCoasterBuilder:Roller Coaster|| Toolbox drawer, drag out an ||rollerCoasterBuilder:add spiral|| block and drop at the end of our code. Then drag out an ||rollerCoasterBuilder:add free fall|| block and drop after. This will create a fun turning 🌀 spiral 🌀 going up followed by a free fall down!

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.addTurn(LEFT_TURN)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Up, 10)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Down, 10)
    rollerCoasterBuilder.addSpiral(RcbVerticalDirection.Up, LEFT_TURN, 10, 3)
    rollerCoasterBuilder.addFreeFall(10)
})

Add a turn

From the ||rollerCoasterBuilder:Roller Coaster|| category, drag out an ||rollerCoasterBuilder:add left turn|| block and drop it at the end of our code. Use the drop-down menu to change “left” to “right”.

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.addTurn(LEFT_TURN)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Up, 10)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Down, 10)
    rollerCoasterBuilder.addSpiral(RcbVerticalDirection.Up, LEFT_TURN, 10, 3)
    rollerCoasterBuilder.addFreeFall(10)
    rollerCoasterBuilder.addTurn(RIGHT_TURN)
})

Add straight line and end

Finally, from the ||rollerCoasterBuilder:Roller Coaster|| Toolbox drawer, drag out an ||rollerCoasterBuilder:add straight line|| block and a ||rollerCoasterBuilder:place track end|| block to the end of our code.

player.onChat("build", function () {
    rollerCoasterBuilder.placeTrackStart(pos(0, 0, 0), NORTH)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.addTurn(LEFT_TURN)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Up, 10)
    rollerCoasterBuilder.addRamp(RcbVerticalDirection.Down, 10)
    rollerCoasterBuilder.addSpiral(RcbVerticalDirection.Up, LEFT_TURN, 10, 3)
    rollerCoasterBuilder.addFreeFall(10)
    rollerCoasterBuilder.addTurn(RIGHT_TURN)
    rollerCoasterBuilder.addStraightLine(10)
    rollerCoasterBuilder.placeTrackEnd()
})

Let’s build it!

Press the 🟩 green 🟩 play button to run your code. Press “t” to open the chat window in Minecraft and type “build” to start constructing our roller coaster!

To ride it, go to the white ⬜ and pink 🧼 wall at the starting point and right-click to Ride in the minecart there. Press the button on the wall to start the roller coaster!

⭐ Woo-hoo!!! ⭐ Now try changing some of the roller coaster blocks and values and add decorations and obstacles to make your own amazing coaster!

rollerCoasterBuilder=github:microsoft/makecode-minecraft-roller-coaster