Atualizar CatMaus/CatMaus.py

This commit is contained in:
Kaio Henrique Lopes Teixeira 2025-02-03 20:52:20 +00:00
parent 1720f77f00
commit ad3602ba8b
1 changed files with 19 additions and 19 deletions

View File

@ -6,16 +6,16 @@ tl.hideturtle()
tl.colormode(255)
t = tl.Turtle()
t.color("Blue")
t.goto(100,0)
t.goto(-100,0)
t2 = tl.Turtle()
t2.color("Red")
t2.goto(-100,0)
t2.goto(100,0)
tl.tracer(1)
che = tl.Turtle()
che.color("Yellow")
che.shape("square")
che.up()
che.goto(-600,600)
cheese = tl.Turtle()
cheese.color("Yellow")
cheese.shape("square")
cheese.up()
cheese.goto(-600,600)
#CENÁRIO
@ -71,10 +71,13 @@ tl.tracer(1)
#funções
global tem_queijo
tem_queijo = False
#pass
def colide():
global tem_queijo
rng = rd.randint(0,5)
chance_tocheese = rd.randint(0,100)
if t.distance(t2) < 10 and tem_queijo == False:
@ -85,26 +88,23 @@ def colide():
elif t2.pos()[1] > 250 or t2.pos()[1] < -300 or t2.pos()[0] > 300 or t2.pos()[0] < -300:
t2.goto(0,0)
elif t.distance(t2) < 10 and tem_queijo == True:
print("Vitoria do Rato")
tl.bye()
if chance_tocheese <= 5:
tl.tracer(0)
che.goto(possible_pos[rng])
cheese.goto(possible_pos[rng])
tl.update()
tl.tracer(1)
if t.distance(che) < 10:
if t.distance(cheese) < 10:
print("queijo coletado!")
tem_queijo = True
che.hideturtle()
if t.distance(t2) < 10:
print("Vitoria do Rato!")
cheese.hideturtle()
def godir():
tl.tracer(0)
t.seth(0)