-
Notifications
You must be signed in to change notification settings - Fork 0
/
find-the-pumpkin.py
62 lines (61 loc) · 2.21 KB
/
find-the-pumpkin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# mini-game which build pumpkin in random place as far as you entered,
# you've got to crush pumpkin block to win or you will die in lava
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
import random
import time
<<<<<<< HEAD
name = input('Who will play?')
ID = mc.getPlayerEntityId(name)
pos = mc.entity.getTilePos(ID)
=======
pos = mc.player.getTilePos()
>>>>>>> 60e7fa3109566d773596606dcb5500aa4ae67298
x,y,z = pos.x,pos.y,pos.z
aw = int(input("How many blocks?-->"))#количество блоков - сложность игры
qwerty = int(input("How many seconds?-->"))
poinsToWin = int(input("How many pumpkins?-->"))
mc.setBlocks(x-aw,y,z-aw,x+aw,y+aw,z+aw,89)#светящийся куб
mc.setBlocks(x-aw+1,y+1,z-aw+1,x+aw-1,y+aw-1,z+aw-1,0)#полость куба
pumX = x + random.randint(-aw+1,aw-1)#даём тыкве случайные координаты
pumY = y + random.randint(1,aw-1)
pumZ = z + random.randint(-aw+1,aw-1)
mc.setBlock(pumX,pumY,pumZ,86)#ставим тыкву
mc.setting('world_immutable',False)
timer = 5
while timer>0:
time.sleep(1)
mc.postToChat("You have "+str(timer)+" seconds to start")
timer-=1
mc.postToChat("Find the pumpkin! Kill him!")
score = 0
while True:
timer = qwerty
while timer>0:
time.sleep(1)
mc.postToChat("You have "+str(timer)+" seconds left...")
timer-=1
if mc.getBlock(pumX,pumY,pumZ)!=86:
mc.postToChat("Pumkin breaked! Well played! Go on!..")
score+=1
mc.postToChat("Yor score is "+str(score)+"/"+str(poinsToWin))
if score>=poinsToWin:
mc.postToChat("Winner!")
break
pumX = x + random.randint(-aw+1,aw-1)#даём тыкве случайные координаты
pumY = y + random.randint(1,aw-1)
pumZ = z + random.randint(-aw+1,aw-1)
mc.setBlock(pumX,pumY,pumZ,86)#ставим тыкву
else:
mc.postToChat("You lost!!!!!")
mc.setting('world_immutable',True)
lavaLayer = 1
while lavaLayer<aw-1:
time.sleep(1)
mc.setBlocks(x-aw+1,y+1+lavaLayer,z-aw+1,x+aw-1,y+1+lavaLayer,z+aw-1,11)
lavaLayer+=1
<<<<<<< HEAD
break
=======
break
>>>>>>> 60e7fa3109566d773596606dcb5500aa4ae67298