Adicionar modo de ganhar e melhorar barcos

This commit is contained in:
Guilherme Aleixo de Oliveira Martins 2024-11-21 13:57:29 -03:00
parent 3062b0e853
commit 26645d8d0b
1 changed files with 6 additions and 2 deletions

View File

@ -49,6 +49,7 @@ for i in range(5):
tl.title("Naval Battle 1943") tl.title("Naval Battle 1943")
tl.hideturtle() tl.hideturtle()
boat = tl.Turtle() boat = tl.Turtle()
boat.shapesize(3, 3)
boat.up(); boat.goto(0,0); boat.left(90) boat.up(); boat.goto(0,0); boat.left(90)
#Enemies #Enemies
@ -58,6 +59,7 @@ enemies = []
for i in range(AMOUNT_OF_ENEMIES): for i in range(AMOUNT_OF_ENEMIES):
enemy = tl.Turtle() enemy = tl.Turtle()
enemy.up() enemy.up()
enemy.hideturtle()
enemy.color("red") enemy.color("red")
pos = [random.choice(posy), random.choice(posy)] pos = [random.choice(posy), random.choice(posy)]
enemy.goto((pos[0] - 2) * 100, (pos[1] - 2) * 100) enemy.goto((pos[0] - 2) * 100, (pos[1] - 2) * 100)
@ -90,7 +92,9 @@ while win == False:
print("errou!") print("errou!")
boat.write("Erramos o alvo\n Capitão!",False,align="center") boat.write("Erramos o alvo\n Capitão!",False,align="center")
acerto = False acerto = False
if len(enemies) <= 0: # tamanho negativo???
win = True
#Execução print("Você ganhou!!")
tl.mainloop()
tl.exitonclick() tl.exitonclick()