From 1e6459eece4240f19f180eaf40a84a1a32a5bd4a Mon Sep 17 00:00:00 2001 From: Kaio Henrique Date: Thu, 28 Nov 2024 17:07:23 -0300 Subject: [PATCH] config turnos --- Naval Battle/NavalBattle.py | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Naval Battle/NavalBattle.py b/Naval Battle/NavalBattle.py index f8ca52e..ffe4816 100644 --- a/Naval Battle/NavalBattle.py +++ b/Naval Battle/NavalBattle.py @@ -171,6 +171,53 @@ if gmode == "single": #sair if bullet.pos() == (1000, 1000): break + + #tiro inimigo + tiro_e = tl.Turtle() + tiro_e.hideturtle() + + #acerto Submarino + if (tiro_pos[tiro_e]) == p1.pos(): + bullet.showturtle() + bullet.goto(tiro_pos[tiro_e]) + print("Acerto!") + bullet.write("U-boat Afundado\n Capitão!",False,align="center") + bullet.hideturtle() + e1.goto(-1000,-1000) + #acerto Crusador + elif (tiro_pos[tiro]) == p2.pos(): + bullet.showturtle() + bullet.goto(tiro_pos[tiro]) + print("Acerto!") + bullet.write("Crusador Afundado\n Capitão!",False,align="center") + bullet.hideturtle() + e2.goto(-1000,-1000) + #acerto Destroyer + elif(tiro_pos[tiro_e]) == p3.pos(): + bullet.showturtle() + bullet.goto(tiro_pos[tiro_e]) + print("Acerto!") + bullet.write("Destroyer Afundado\n Capitão!",False,align="center") + bullet.hideturtle() + e3.goto(-1000,-1000) + #erro + elif (tiro_pos[tiro_e]) != p1.pos() and (tiro_pos[tiro_e]) != p2.pos() and (tiro_pos[tiro_e]) != p3.pos(): + bullet.showturtle() + bullet.goto(tiro_pos[tiro_e]) + print("errou!") + bullet.write("Erramos o alvo\n Capitão!",False,align="center") + bullet.hideturtle() + #vencer + if (p1.pos() == (-1000, -1000)) and (p2.pos() == (-1000, -1000)) and (p3.pos() == (-1000, -1000)): + print("voçe ganhou") + break + #sair + if tiro_e.pos() == (1000, 1000): + break + + + + @@ -249,6 +296,8 @@ elif gmode == "multi": continue #partidas +#TELA DE VITORIA + #Execução tl.mainloop() tl.exitonclick()