forked from 20241144010013/20241144010013
Compare commits
13 Commits
multiplayer
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ad3602ba8b | |||
| 1720f77f00 | |||
| 19a9d1fafa | |||
| 8f05eb6d2c | |||
| c055b048df | |||
| 74f77706c9 | |||
| bffbecab78 | |||
| ba9aa38055 | |||
| 1e6459eece | |||
| 6387992312 | |||
| b62d22aa4c | |||
| 93eda0f85f | |||
| 92a6efc621 |
@@ -0,0 +1,207 @@
|
|||||||
|
import turtle as tl
|
||||||
|
import random as rd
|
||||||
|
#setup
|
||||||
|
tl.setup(600,600,None,None)
|
||||||
|
tl.hideturtle()
|
||||||
|
tl.colormode(255)
|
||||||
|
t = tl.Turtle()
|
||||||
|
t.color("Blue")
|
||||||
|
t.goto(-100,0)
|
||||||
|
t2 = tl.Turtle()
|
||||||
|
t2.color("Red")
|
||||||
|
t2.goto(100,0)
|
||||||
|
tl.tracer(1)
|
||||||
|
cheese = tl.Turtle()
|
||||||
|
cheese.color("Yellow")
|
||||||
|
cheese.shape("square")
|
||||||
|
cheese.up()
|
||||||
|
cheese.goto(-600,600)
|
||||||
|
|
||||||
|
#CENÁRIO
|
||||||
|
|
||||||
|
#moldura
|
||||||
|
tl.tracer(0)
|
||||||
|
tl.color("black")
|
||||||
|
tl.up()
|
||||||
|
tl.goto(-300,-300)
|
||||||
|
tl.down()
|
||||||
|
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):
|
||||||
|
tl.color((139, 69, 19))
|
||||||
|
tl.up()
|
||||||
|
tl.goto(-300, _ * 50)
|
||||||
|
tl.down()
|
||||||
|
tl.goto(300, _ * 50)
|
||||||
|
tl.up()
|
||||||
|
|
||||||
|
tl.color("light blue")
|
||||||
|
tl.goto(-300, 300)
|
||||||
|
tl.down()
|
||||||
|
tl.begin_fill()
|
||||||
|
|
||||||
|
#parede
|
||||||
|
tl.goto(-300, 250)
|
||||||
|
tl.goto(300, 250)
|
||||||
|
tl.goto(300,300)
|
||||||
|
tl.end_fill()
|
||||||
|
|
||||||
|
#casa de rato
|
||||||
|
tl.up()
|
||||||
|
tl.goto(170, 250)
|
||||||
|
tl.color("black")
|
||||||
|
tl.down()
|
||||||
|
tl.begin_fill()
|
||||||
|
tl.goto(190,250)
|
||||||
|
tl.goto(190,260)
|
||||||
|
tl.left(90)
|
||||||
|
tl.circle(10, 180)
|
||||||
|
tl.end_fill()
|
||||||
|
|
||||||
|
#FIM-CENÁRIO
|
||||||
|
tl.update()
|
||||||
|
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:
|
||||||
|
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)
|
||||||
|
|
||||||
|
elif t.distance(t2) < 10 and tem_queijo == True:
|
||||||
|
print("Vitoria do Rato")
|
||||||
|
tl.bye()
|
||||||
|
|
||||||
|
if chance_tocheese <= 5:
|
||||||
|
tl.tracer(0)
|
||||||
|
cheese.goto(possible_pos[rng])
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
if t.distance(cheese) < 10:
|
||||||
|
print("queijo coletado!")
|
||||||
|
tem_queijo = True
|
||||||
|
cheese.hideturtle()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def godir():
|
||||||
|
tl.tracer(0)
|
||||||
|
t.seth(0)
|
||||||
|
t.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def goleft():
|
||||||
|
tl.tracer(0)
|
||||||
|
t.seth(180)
|
||||||
|
t.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def goup():
|
||||||
|
tl.tracer(0)
|
||||||
|
t.seth(90)
|
||||||
|
t.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def godown():
|
||||||
|
tl.tracer(0)
|
||||||
|
t.seth(270)
|
||||||
|
t.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
# pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#segunda tartaruga
|
||||||
|
def godir2():
|
||||||
|
tl.tracer(0)
|
||||||
|
t2.seth(0)
|
||||||
|
t2.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def goleft2():
|
||||||
|
tl.tracer(0)
|
||||||
|
t2.seth(180)
|
||||||
|
t2.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def goup2():
|
||||||
|
tl.tracer(0)
|
||||||
|
t2.seth(90)
|
||||||
|
t2.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
|
||||||
|
|
||||||
|
#pass
|
||||||
|
def godown2():
|
||||||
|
tl.tracer(0)
|
||||||
|
t2.seth(270)
|
||||||
|
t2.forward(50)
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
|
colide()
|
||||||
|
#pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#execução
|
||||||
|
tl.onkeypress(godir,"d")
|
||||||
|
tl.onkeypress(goleft,"a")
|
||||||
|
tl.onkeypress(goup,"w")
|
||||||
|
tl.onkeypress(godown, "s")
|
||||||
|
tl.onkeypress(godir2,"Right")
|
||||||
|
tl.onkeypress(goleft2,"Left")
|
||||||
|
tl.onkeypress(goup2,"Up")
|
||||||
|
tl.onkeypress(godown2, "Down")
|
||||||
|
tl.listen()
|
||||||
|
|
||||||
|
#loop
|
||||||
|
tl.mainloop()
|
||||||
+268
-67
@@ -1,115 +1,316 @@
|
|||||||
|
#esse jogo ainda está sob teste... e não deve ser considerado completo
|
||||||
#setup
|
#setup
|
||||||
import turtle as tl
|
import turtle as tl
|
||||||
import random
|
import random
|
||||||
|
|
||||||
posx = [-200, -100, 0, 100, 200]
|
posx = [-200, -100, 0, 100, 200]
|
||||||
posy = [-200, -100, 0, 100, 200]
|
posy = [-200, -100, 0, 100, 200]
|
||||||
postiro = ['-200 -200', '-200 -100', '-200 0', '-200 100', '-200 200', '-100 -200', '-100 -100', '-100 0', '-100 100', '-100 200', '0 -200', '0 -100', '0 0', '0 100', '0 200', '100 -200', '100 -100', '100 0', '100 100', '100 200', '200 -200', '200 -100', '200 0', '200 100', '200 200']
|
|
||||||
|
|
||||||
tl.setup(650,650,None,None)
|
tl.setup(650,650,None,None)
|
||||||
tl.title("Naval Battle 1943 Loading...")
|
tl.title("Naval Battle 1943 Loading...")
|
||||||
tl.speed(0)
|
tl.speed(0)
|
||||||
|
|
||||||
|
#posições possiveis
|
||||||
|
tiro_pos = {
|
||||||
|
"A1": (200,200),
|
||||||
|
"A2": (200,100),
|
||||||
|
"A3": (200,0),
|
||||||
|
"A4": (200,-100),
|
||||||
|
"A5": (200,-200),
|
||||||
|
"B1": (100,200),
|
||||||
|
"B2": (100,100),
|
||||||
|
"B3": (100,0),
|
||||||
|
"B4": (100,-100),
|
||||||
|
"B5": (100,-200),
|
||||||
|
"C1": (0,200),
|
||||||
|
"C2": (0,100),
|
||||||
|
"C3": (0,0),
|
||||||
|
"C4": (0,-100),
|
||||||
|
"C5": (0,-200),
|
||||||
|
"D1": (-100,200),
|
||||||
|
"D2": (-100,100),
|
||||||
|
"D3": (-100,0),
|
||||||
|
"D4": (-100,-100),
|
||||||
|
"D5": (-100,-200),
|
||||||
|
"E1": (-200,200),
|
||||||
|
"E2": (-200,100),
|
||||||
|
"E3": (-200,0),
|
||||||
|
"E4": (-200,-100),
|
||||||
|
"E5": (-200,-200),
|
||||||
|
"QUIT": (1000, 1000),
|
||||||
|
}
|
||||||
|
|
||||||
#funções
|
#funções
|
||||||
def linhax(x,y):
|
def linhax(x,y):
|
||||||
tl.up(); tl.goto(x,y)
|
tl.up(); tl.goto(x,y)
|
||||||
tl.down(); tl.goto(x+600,y)
|
tl.down(); tl.goto(x+600,y)
|
||||||
pass
|
#pass
|
||||||
|
|
||||||
def linhay(x,y):
|
def linhay(x,y):
|
||||||
tl.up(); tl.goto(x,y)
|
tl.up(); tl.goto(x,y)
|
||||||
tl.down(); tl.goto(x,y+600)
|
tl.down(); tl.goto(x,y+600)
|
||||||
pass
|
#pass
|
||||||
|
|
||||||
|
|
||||||
#radar screen
|
#radar screen
|
||||||
tl.bgcolor("lime green")
|
tl.bgcolor("lime green")
|
||||||
#moldura
|
#moldura
|
||||||
|
tl.tracer(0)
|
||||||
linhax(-300,-300)
|
linhax(-300,-300)
|
||||||
linhay(-300,-300)
|
linhay(-300,-300)
|
||||||
linhay(300,-300)
|
linhay(300,-300)
|
||||||
linhax(-300,300)
|
linhax(-300,300)
|
||||||
|
|
||||||
#linhas X
|
#linhas X
|
||||||
linhax(-300,-200); tl.write("-200",False,align="right")
|
linhax(-300,-200); tl.write("5",False,align="right")
|
||||||
linhax(-300,-100); tl.write("-100",False,align="right")
|
linhax(-300,-100); tl.write("4",False,align="right")
|
||||||
linhax(-300,0); tl.write("0",False,align="right")
|
linhax(-300,0); tl.write("3",False,align="right")
|
||||||
linhax(-300,100); tl.write("100",False,align="right")
|
linhax(-300,100); tl.write("2",False,align="right")
|
||||||
linhax(-300,200); tl.write("200",False,align="right")
|
linhax(-300,200); tl.write("1",False,align="right")
|
||||||
|
|
||||||
#linhas Y
|
#linhas Y
|
||||||
linhay(-200,-300); tl.write("-200",False,align="right")
|
linhay(-200,-300); tl.write("E",False,align="right")
|
||||||
linhay(-100,-300); tl.write("-200",False,align="right")
|
linhay(-100,-300); tl.write("D",False,align="right")
|
||||||
linhay(0,-300); tl.write("-200",False,align="right")
|
linhay(0,-300); tl.write("C",False,align="right")
|
||||||
linhay(100,-300); tl.write("-200",False,align="right")
|
linhay(100,-300); tl.write("B",False,align="right")
|
||||||
linhay(200,-300); tl.write("-200",False,align="right")
|
linhay(200,-300); tl.write("A",False,align="right")
|
||||||
#Tabuleiro pronto
|
#Tabuleiro pronto
|
||||||
|
tl.update()
|
||||||
|
tl.tracer(1)
|
||||||
tl.title("Naval Battle 1943")
|
tl.title("Naval Battle 1943")
|
||||||
tl.hideturtle()
|
tl.hideturtle()
|
||||||
boat = tl.Turtle()
|
|
||||||
boat.up(); boat.goto(0,0); boat.left(90)
|
|
||||||
|
|
||||||
#Enemies
|
bullet = tl.Turtle()
|
||||||
e1 = tl.Turtle()
|
bullet.color("Yellow")
|
||||||
e1.up()
|
bullet.hideturtle()
|
||||||
e1.color("red")
|
bullet.up()
|
||||||
e1.goto(-100,-100)
|
|
||||||
|
#gamemode SinglePlayer
|
||||||
|
gmode = tl.textinput("Modo de Jogo","Qual Modo Deseja jogar?\ndigite multi para jogar com um amigo do lado\ne single para jogar sozinho")
|
||||||
|
if gmode == "single":
|
||||||
|
win = False
|
||||||
|
print("Modo Solitario Selecionado! escolha onde ficaram seus navios")
|
||||||
|
#Player 1
|
||||||
|
p1 = tl.Turtle()
|
||||||
|
p1.up()
|
||||||
|
spawnp1 = "A1" #str(input("Senhor, Onde Nosso Submarino Deve Ficar? "))
|
||||||
|
p1.goto(tiro_pos[spawnp1])
|
||||||
|
|
||||||
|
p2 = tl.Turtle()
|
||||||
|
p2.up()
|
||||||
|
spawnp2 = "A2" #str(input("Senhor, Onde Nosso Crusador Deve Ficar? "))
|
||||||
|
p2.goto(tiro_pos[spawnp2])
|
||||||
|
|
||||||
|
p3 = tl.Turtle()
|
||||||
|
p3.up()
|
||||||
|
spawnp3 = "A3" #str(input("Senhor, Onde Nosso Destroyer Deve Ficar? "))
|
||||||
|
p3.goto(tiro_pos[spawnp3])
|
||||||
|
#pass
|
||||||
|
|
||||||
|
#inimigos
|
||||||
|
e1 = tl.Turtle()
|
||||||
|
e1.up()
|
||||||
|
e1.color("red")
|
||||||
|
e1.goto(random.choice(posx), random.choice(posy))
|
||||||
|
|
||||||
|
|
||||||
e2 = tl.Turtle()
|
e2 = tl.Turtle()
|
||||||
e2.up()
|
e2.up()
|
||||||
e2.color("red")
|
e2.color("red")
|
||||||
e2.goto(random.choice(posx), random.choice(posy))
|
|
||||||
if e1.pos() == e2.pos():
|
|
||||||
e2.goto(random.choice(posx), random.choice(posy))
|
e2.goto(random.choice(posx), random.choice(posy))
|
||||||
|
if e1.pos() == e2.pos():
|
||||||
|
e2.goto(random.choice(posx), random.choice(posy))
|
||||||
|
|
||||||
|
|
||||||
e3 = tl.Turtle()
|
e3 = tl.Turtle()
|
||||||
e3.up()
|
e3.up()
|
||||||
e3.color("red")
|
e3.color("red")
|
||||||
e3.goto(random.choice(posx), random.choice(posy))
|
|
||||||
if e1.pos() == e3.pos():
|
|
||||||
e3.goto(random.choice(posx), random.choice(posy))
|
|
||||||
if e2.pos() == e3.pos():
|
|
||||||
e3.goto(random.choice(posx), random.choice(posy))
|
e3.goto(random.choice(posx), random.choice(posy))
|
||||||
|
if e1.pos() == e3.pos():
|
||||||
|
e3.goto(random.choice(posx), random.choice(posy))
|
||||||
|
if e2.pos() == e3.pos():
|
||||||
|
e3.goto(random.choice(posx), random.choice(posy))
|
||||||
|
#pass
|
||||||
|
while win == False:
|
||||||
|
tiro = tl.textinput("Onde Devemos Disparar?","Em Qual Intersecão Devemos Disparar?\nDigite (quit) Para Sair").upper()
|
||||||
|
while tiro not in tiro_pos:
|
||||||
|
tiro = tl.textinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||||
|
#acerto Submarino
|
||||||
|
if (tiro_pos[tiro]) == e1.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
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]) == e2.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]) == e3.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("Acerto!")
|
||||||
|
bullet.write("Destroyer Afundado\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
e3.goto(-1000,-1000)
|
||||||
|
#erro
|
||||||
|
elif (tiro_pos[tiro]) != e1.pos() and (tiro_pos[tiro]) != e2.pos() and (tiro_pos[tiro]) != e3.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("errou!")
|
||||||
|
bullet.write("Erramos o alvo\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
#vencer
|
||||||
|
if (e1.pos() == (-1000, -1000)) and (e2.pos() == (-1000, -1000)) and (e3.pos() == (-1000, -1000)):
|
||||||
|
print("voçe ganhou")
|
||||||
|
break
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Multiplayer
|
||||||
|
elif gmode == "multi":
|
||||||
|
win = False
|
||||||
|
print("Modo Multiplayer Selecionado! Fique ao lado de seu amigo\nnão olhe os navios dele e vice-versa")
|
||||||
|
#Player 1
|
||||||
|
p1 = tl.Turtle()
|
||||||
|
p1.up()
|
||||||
|
spawnp1 = str(input("Senhor, Onde Nosso Submarino Deve Ficar? "))
|
||||||
|
p1.goto(tiro_pos[spawnp1])
|
||||||
|
|
||||||
|
p2 = tl.Turtle()
|
||||||
|
p2.up()
|
||||||
|
spawnp2 = str(input("Senhor, Onde Nosso Crusador Deve Ficar? "))
|
||||||
|
p2.goto(tiro_pos[spawnp2])
|
||||||
|
|
||||||
|
p3 = tl.Turtle()
|
||||||
|
p3.up()
|
||||||
|
spawnp3 = str(input("Senhor, Onde Nosso Destroyer Deve Ficar? "))
|
||||||
|
p3.goto(tiro_pos[spawnp3])
|
||||||
|
#pass
|
||||||
|
|
||||||
|
#player 2
|
||||||
|
p1_2 = tl.Turtle()
|
||||||
|
p1_2.up()
|
||||||
|
spawnp1_2 = str(input("Senhor, Onde Nosso Submarino Deve Ficar? "))
|
||||||
|
p1_2.goto(tiro_pos[spawnp1_2])
|
||||||
|
|
||||||
|
p2_2 = tl.Turtle()
|
||||||
|
p2_2.up()
|
||||||
|
spawnp2_2 = str(input("Senhor, Onde Nosso Crusador Deve Ficar? "))
|
||||||
|
p2_2.goto(tiro_pos[spawnp2_2])
|
||||||
|
|
||||||
|
p3_2 = tl.Turtle()
|
||||||
|
p3_2.up()
|
||||||
|
spawnp3_2 = str(input("Senhor, Onde Nosso Destroyer Deve Ficar? "))
|
||||||
|
p3_2.goto(tiro_pos[spawnp3_2])
|
||||||
|
#pass
|
||||||
|
|
||||||
|
while win == False:
|
||||||
|
tiro = tl.textinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||||
|
if (tiro_pos[tiro]) == p1.pos() or (tiro_pos[tiro]) == p1_2.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("Acerto!")
|
||||||
|
bullet.write("U-boat Afundado\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
break
|
||||||
|
elif (tiro_pos[tiro]) == p2.pos() or (tiro_pos[tiro]) == p2_2.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("Acerto!")
|
||||||
|
bullet.write("Crusador Afundado\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
break
|
||||||
|
elif(tiro_pos[tiro]) == p3.pos() or (tiro_pos[tiro]) == p3_2.pos():
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("Acerto!")
|
||||||
|
bullet.write("Destroyer Afundado\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
bullet.showturtle()
|
||||||
|
bullet.goto(tiro_pos[tiro])
|
||||||
|
print("errou!")
|
||||||
|
bullet.write("Erramos o alvo\n Capitão!",False,align="center")
|
||||||
|
bullet.hideturtle()
|
||||||
|
continue
|
||||||
#partidas
|
#partidas
|
||||||
win = False
|
|
||||||
while win == False:
|
|
||||||
tirox = tl.numinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
|
||||||
tiroy = tl.numinput("linha Y do disparo","Em qual quadrante Y devemos disparar a artilharia")
|
|
||||||
if (tirox,tiroy) == e1.pos():
|
|
||||||
boat.goto(tirox,tiroy)
|
|
||||||
print("Acerto!")
|
|
||||||
boat.write("U-boat Afundado\n Capitão!",False,align="center")
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
boat.goto(tirox,tiroy)
|
|
||||||
print("errou!")
|
|
||||||
boat.write("Erramos o alvo\n Capitão!",False,align="center")
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#TELA DE VITORIA
|
||||||
|
|
||||||
#Execução
|
#Execução
|
||||||
tl.mainloop()
|
tl.mainloop()
|
||||||
tl.exitonclick()
|
tl.exitonclick()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import pyautogui as auto
|
||||||
|
|
||||||
|
confirma = auto.confirm("Startar o programa", "Start-up", buttons=["Sim", "Não"])
|
||||||
|
if confirma == "Sim":
|
||||||
|
senha = auto.password(text='Qual sua Senha do SUAP', title='Senha', default='', mask='*')
|
||||||
|
auto.PAUSE = 1.5
|
||||||
|
auto.press("win")
|
||||||
|
auto.write("chrome")
|
||||||
|
auto.press("enter")
|
||||||
|
auto.write("https://suap.ifrn.edu.br/accounts/login/")
|
||||||
|
auto.press("enter")
|
||||||
|
auto.write("20241144010013")
|
||||||
|
auto.press("tab")
|
||||||
|
auto.write(senha)
|
||||||
|
auto.press("enter")
|
||||||
|
auto.hotkey("ctrl","t")
|
||||||
|
auto.press("win")
|
||||||
|
auto.write("code")
|
||||||
|
auto.press("enter")
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user