Leap of faith
Let’s build a Leap of Faith mini-game.
Make a pool of water
Fill a 3x3x3
pool of water in the ground (negative y)
# @highlight
blocks.fill(WATER,
# @highlight
pos(-1, -3, -1),
# @highlight
pos(1, -1, 1),
# @highlight
FillOperation.REPLACE)
Try it!
Run the program and check to see that a pool of water is created.
Build a jumping platform
Build a 3x3
stone platform that goes up 128 blocks high.
blocks.fill(WATER,
pos(-1, -3, -1),
pos(1, -1, 1),
FillOperation.REPLACE)
# @highlight
blocks.fill(STONE,
# @highlight
pos(-1, 128, -1),
# @highlight
pos(1, 128, 1),
# @highlight
FillOperation.REPLACE)
Try it again
Run the program again. Make sure a pool and a platform are created.
Teleport the player
Teleport the player above the platform.
blocks.fill(WATER,
pos(-1, -3, -1),
pos(1, -1, 1),
FillOperation.REPLACE)
blocks.fill(STONE,
pos(-1, 128, -1),
pos(1, 128, 1),
FillOperation.REPLACE)
# @highlight
player.teleport(pos(0, 130, 0))
Set Survival Mode
Turn on survival mode for the nearest player.
blocks.fill(WATER,
pos(-1, -3, -1),
pos(1, -1, 1),
FillOperation.REPLACE)
blocks.fill(STONE,
pos(-1, 128, -1),
pos(1, 128, 1),
FillOperation.REPLACE)
player.teleport(pos(0, 130, 0))
# @highlight
gameplay.set_game_mode(SURVIVAL, mobs.target(NEAREST_PLAYER))
Play the game!
Run the program now and play your game!