forked from 20241144010013/20241144010013
battle
This commit is contained in:
parent
93eda0f85f
commit
b62d22aa4c
|
@ -128,12 +128,16 @@ if gmode == "single":
|
||||||
if e2.pos() == e3.pos():
|
if e2.pos() == e3.pos():
|
||||||
e3.goto(random.choice(posx), random.choice(posy))
|
e3.goto(random.choice(posx), random.choice(posy))
|
||||||
#pass
|
#pass
|
||||||
|
#vencer
|
||||||
|
if win == True:
|
||||||
|
tl.Terminator()
|
||||||
|
|
||||||
|
|
||||||
while win == False:
|
while win == False:
|
||||||
e1_sunk = False
|
|
||||||
e2_sunk = False
|
|
||||||
e3_sunk = False
|
|
||||||
tiro = tl.textinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
tiro = tl.textinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||||
|
#vencer
|
||||||
|
if win == True:
|
||||||
|
break
|
||||||
#acerto Submarino
|
#acerto Submarino
|
||||||
if (tiro_pos[tiro]) == e1.pos():
|
if (tiro_pos[tiro]) == e1.pos():
|
||||||
bullet.showturtle()
|
bullet.showturtle()
|
||||||
|
@ -141,7 +145,7 @@ if gmode == "single":
|
||||||
print("Acerto!")
|
print("Acerto!")
|
||||||
bullet.write("U-boat Afundado\n Capitão!",False,align="center")
|
bullet.write("U-boat Afundado\n Capitão!",False,align="center")
|
||||||
bullet.hideturtle()
|
bullet.hideturtle()
|
||||||
e1_sunk = True
|
e1.goto(-1000,-1000)
|
||||||
#acerto Crusador
|
#acerto Crusador
|
||||||
elif (tiro_pos[tiro]) == e2.pos():
|
elif (tiro_pos[tiro]) == e2.pos():
|
||||||
bullet.showturtle()
|
bullet.showturtle()
|
||||||
|
@ -149,7 +153,7 @@ if gmode == "single":
|
||||||
print("Acerto!")
|
print("Acerto!")
|
||||||
bullet.write("Crusador Afundado\n Capitão!",False,align="center")
|
bullet.write("Crusador Afundado\n Capitão!",False,align="center")
|
||||||
bullet.hideturtle()
|
bullet.hideturtle()
|
||||||
e2_sunk = True
|
e2.goto(-1000,-1000)
|
||||||
#acerto Destroyer
|
#acerto Destroyer
|
||||||
elif(tiro_pos[tiro]) == e3.pos():
|
elif(tiro_pos[tiro]) == e3.pos():
|
||||||
bullet.showturtle()
|
bullet.showturtle()
|
||||||
|
@ -157,20 +161,20 @@ if gmode == "single":
|
||||||
print("Acerto!")
|
print("Acerto!")
|
||||||
bullet.write("Destroyer Afundado\n Capitão!",False,align="center")
|
bullet.write("Destroyer Afundado\n Capitão!",False,align="center")
|
||||||
bullet.hideturtle()
|
bullet.hideturtle()
|
||||||
e3_sunk = True
|
e3.goto(-1000,-1000)
|
||||||
#erro
|
#erro
|
||||||
elif (tiro_pos[tiro]) != e1.pos() or (tiro_pos[tiro]) != e2.pos() or (tiro_pos[tiro]) != e3.pos():
|
elif (tiro_pos[tiro]) != e1.pos() and (tiro_pos[tiro]) != e2.pos() and (tiro_pos[tiro]) != e3.pos():
|
||||||
bullet.showturtle()
|
bullet.showturtle()
|
||||||
bullet.goto(tiro_pos[tiro])
|
bullet.goto(tiro_pos[tiro])
|
||||||
print("errou!")
|
print("errou!")
|
||||||
bullet.write("Erramos o alvo\n Capitão!",False,align="center")
|
bullet.write("Erramos o alvo\n Capitão!",False,align="center")
|
||||||
bullet.hideturtle()
|
bullet.hideturtle()
|
||||||
continue
|
|
||||||
|
|
||||||
elif e1_sunk == True and (e2_sunk == True) and (e3_sunk == True):
|
#erro
|
||||||
break
|
if e1.pos() not in tiro_pos and e2.pos() not in tiro_pos and e3.pos() not in tiro_pos:
|
||||||
else:
|
win = True
|
||||||
print("Voçe ganhou!")
|
print("voçe ganhou")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue