Wednesday 13 December 2017

M:EE MakeCode blog 4 "Wool Wall"



M:EE MakeCode blog 4 "Wool Wall"

This takes the code from blog  3 and extends it through using variables and loops  to repeat instructions and create a wool wall. You can interact with the code here:
https://makecode.com/_gwz8jKgsbFdD
 (See below):



Here is the code:



Here is the JavaScript code that it generates:
let Count = 0
let Rows = 0
player.onChat("wall", function () {
Rows = 20
Count = 0
    for (let i = 0; i < Rows; i++) {
        blocks.place(blocks.block(Block.LimeWool), positions.create(-3, Count, 10))
        blocks.place(blocks.block(Block.Wool), positions.create(-2, Count, 10))
        blocks.place(blocks.block(Block.OrangeWool), positions.create(-1, Count, 10))
        blocks.place(blocks.block(Block.MagentaWool), positions.create(0, Count, 10))
        blocks.place(blocks.block(Block.LightBlueWool), positions.create(1, Count, 10))
        blocks.place(blocks.block(Block.YellowWool), positions.create(2, Count, 10))
        blocks.place(blocks.block(Block.PinkWool), positions.create(3, Count, 10))
Count += 1
    }
})


No comments:

Post a Comment