Wednesday, 7 April 2021

Whack a block Pixel Art

 

#colours

# Orange

# Pink / Skin

# Green

# White

# Red

# Sky blue / cyan

# Brown

# DARK GREEN

# Black


#faces


#@kari lawlor

Creeper = [

[DG, DG, DG, DG, DG, DG, DG, DG],

[DG, BL, BL, DG, DG, BL, BL, DG],

[DG, BL, BL, DG, DG, BL, BL, DG],

[DG, DG, DG, BL, BL, DG, DG, DG],

[DG, DG, BL, BL, BL, BL, DG, DG],

[DG, DG, BL, BL, BL, BL, DG, DG],

[DG, DG, BL, DG, DG, BL, DG, DG],

[DG, DG, DG, DG, DG, DG, DG, DG],

]


#Pig 


#Alex



#print pixel art

#By @KariLawler (Twitter)

def print_PixelArt(List):

    block = 35 # wool

    x, y, z = mc.player.getPos()

    pixel_y = y + len(List) - 1

    pixel_z = z - 6

    for row in List:

        pixel_x = x

        for pixel in row:

            if pixel > -1:

                mc.setBlock(pixel_x, pixel_y, pixel_z, block, pixel)

            pixel_x += 1

        pixel_y -= 1


mc.postToChat("Please hit the TNT block")


while True:


    evs = mc.events.pollBlockHits()

    for e in evs:

        pos = e.pos


        block = mc.getBlock(pos.x, pos.y, pos.z)


        if block == 46:#TNT

            mc.postToChat("Creeper")

            print_PixelArt(Creeper)

        elif block == 20:#glasselse:

            mc.postToChat("Other block")