forked from 20241144010013/20241144010013
update Catmaus
This commit is contained in:
parent
c055b048df
commit
8f05eb6d2c
|
@ -11,6 +11,11 @@ t2 = tl.Turtle()
|
|||
t2.color("Red")
|
||||
t2.goto(-100,0)
|
||||
tl.tracer(1)
|
||||
che = tl.Turtle()
|
||||
che.color("Yellow")
|
||||
che.shape("square")
|
||||
che.up()
|
||||
che.goto(-600,600)
|
||||
|
||||
#CENÁRIO
|
||||
|
||||
|
@ -24,6 +29,9 @@ tl.goto(-300,300)
|
|||
tl.goto(300,300)
|
||||
tl.goto(300,-300)
|
||||
|
||||
#queijo
|
||||
possible_pos = [(200,250),(-100,-250), (250,-250),(-50,200),(100,-150),(100,0)]
|
||||
|
||||
#linhas
|
||||
tl.bgcolor((205, 133, 63))
|
||||
for _ in range(-6, 6):
|
||||
|
@ -63,13 +71,38 @@ tl.tracer(1)
|
|||
|
||||
|
||||
#funções
|
||||
|
||||
tem_queijo = False
|
||||
#pass
|
||||
|
||||
def colide():
|
||||
if t.distance(t2) < 10:
|
||||
print("Vitoria")
|
||||
rng = rd.randint(0,5)
|
||||
chance_tocheese = rd.randint(0,100)
|
||||
if t.distance(t2) < 10 and tem_queijo == False:
|
||||
print("Vitoria do Gato")
|
||||
tl.bye()
|
||||
elif t.pos()[1] > 250 or t.pos()[1] < -300 or t.pos()[0] > 300 or t.pos()[0] <- 300:
|
||||
t.goto(0,0)
|
||||
|
||||
elif t2.pos()[1] > 250 or t2.pos()[1] < -300 or t2.pos()[0] > 300 or t2.pos()[0] < -300:
|
||||
t2.goto(0,0)
|
||||
if chance_tocheese <= 5:
|
||||
tl.tracer(0)
|
||||
che.goto(possible_pos[rng])
|
||||
tl.update()
|
||||
tl.tracer(1)
|
||||
if t.distance(che) < 10:
|
||||
print("queijo coletado!")
|
||||
tem_queijo = True
|
||||
che.hideturtle()
|
||||
if t.distance(t2) < 10:
|
||||
print("Vitoria do Rato!")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def godir():
|
||||
|
@ -165,7 +198,7 @@ tl.onkeypress(goleft,"a")
|
|||
tl.onkeypress(goup,"w")
|
||||
tl.onkeypress(godown, "s")
|
||||
tl.onkeypress(godir2,"Right")
|
||||
tl.onkeypress(goleft2,"Leftd")
|
||||
tl.onkeypress(goleft2,"Left")
|
||||
tl.onkeypress(goup2,"Up")
|
||||
tl.onkeypress(godown2, "Down")
|
||||
tl.listen()
|
||||
|
|
Loading…
Reference in New Issue