Hardware Reference
In-Depth Information
FIGURE.7-9 A pyramid made of triangles, which fits exactly into a circle
3. Create the findPointOnCircle() function, which will be used to work out
where each of the triangles which make up the pyramid will be placed:
def findPointOnCircle(cx, cy, radius, angle):
x = cx + math.sin(math.radians(angle)) * radius
y = cy + math.cos(math.radians(angle)) * radius
x = int(round(x, 0))
y = int(round(y, 0))
return(x,y)
4. Connect to Minecraft and create the MinecraftDrawing object:
mc = minecraft.Minecraft.create()
mcdrawing = minecraftstuff.MinecraftDrawing(mc)
5. Now set up the variables for your pyramid. The middle of the pyramid will be the
player's position. The values of these variables will change the size (or radius),
height and number of sides of the pyramid. Type:
pyramidMiddle = mc.player.getTilePos()
PYRAMID_RADIUS = 20
PYRAMID_HEIGHT = 10
PYRAMID_SIDES = 4
6. Loop through each side of the pyramid; all the code after this point will be
indented under the for loop:
for side in range(0, PYRAMID_SIDES):
Search WWH ::




Custom Search