Photographer's Flat

Sometimes I like to view a structure from above the ground. Players in CodeCraft world is programmed with universal gravity. If you try jumping and taking a screen shot, the time is not enough. I tried to set the player at a high position, but since the player has gravity, he won't stay, so I decided to build a floating flat for the player to stand on.

Here I need to insert a small topic: get and set the player's location, we will call two methods, the getter and setter of game object:

game.get_player_position() returns player's position as (x,y,z) like (3,1,-5);

game.set_player_position(Position(x,y,z)) will set player at location indicated by Position(x,y,z), for example (3,10,-5)

Demo the getter and setter methods:

# call the getter
game.get_player_position()          # (10,1,-5)
# move to some where else and call getter again
game.get_player_position()          # (-12,1, -10)
# call the setter
game.set_player_position(Position(0,1,-10)

Run the above steps one by one, you will notice the player's location change accordingly.

Photographer's Flat

Steps to build a photographer's flat high above the player's ground location:

find out the ground location of the player (x,y,z), build a floating flat at (x, y+10, z), set the player's position at (x, y+11, z)

# get position
print(game.get_player_position())   # (9,1,-10)

# build:
flat_xz(9, 10, -10, 5, 5, 'diamond')

# set position
game.set_player_position(Position(9,11,-10))

The getter method returned the player's ground location, (9,1,-10); we build a 5*5 floating flat_xz at (9,10,-10); then use the setter method, game.set_player_postion() to set the player on top of the flat so he has a high view of the world.

See a high view of a previous block array:

See a high view of the Golden Gate:

See a high view of a forest:

Opps! We didn't learn to build a tree yet, let's go on to build a tree, then a forest...

results matching ""

    No results matching ""