def main(): plan1 = "200 200 400 400" plan2 = "0 250 600 300" plan3 = "" plan4 = "" plan5 = "" janela = tkinter.Tk() canvas_altura = 720 canvas_largura = 1280 tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura) #~ quad = tela.create_rectangle(20,20,150,160,width=2,fill="red") pl1 = TP.cria_plano(plan1) pl2 = TP.cria_plano(plan2) quad1 = tela.create_rectangle(pl1, width=1, fill="red") quad2 = tela.create_rectangle(pl2, width=1, fill="blue") pl_sob = TP.sobreposicao_planos(pl1, pl2) if None != pl_sob: tela.create_rectangle(pl_sob, width=1, fill="purple") tela.pack() #~ for i in range(100): #~ #~ tela.move(quad1,5,5) #~ tela.update() #~ time.sleep(.1) janela.mainloop() return 0
def main(): ############## tkinter criando janelas janela = tkinter.Tk() # canvas_altura = 600 # canvas_largura = 600 # tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura) # ############### ######## paredes plano1= TP.cria_plano("200 200 400 400") plano2= TP.cria_plano("150 350 300 450") plano3= TP.cria_plano("300 150 450 300") plano4= TP.cria_plano("300 250 350 500") tela.create_rectangle(plano1,width=0,fill="red") tela.create_rectangle(plano2,width=1,fill="blue") #~ tela.create_rectangle(plano3,width=1,fill="green") #~ tela.create_rectangle(plano4,width=1,fill="lightblue") dif1=TP.sobreposicao_planos(plano1,plano2) print(dif1[0]-plano2[0],dif1[1]-plano2[1],dif1[2]-plano2[2],dif1[3]-plano2[3]) #~ dif2=TP.sobreposicao_planos(plano1,plano3) #~ print(dif2[0]-plano3[0],dif2[1]-plano3[1],dif2[2]-plano3[2],dif2[3]-plano3[3]) #~ dif3=TP.sobreposicao_planos(plano1,plano4) #~ print(dif3[0]-plano4[0],dif3[1]-plano4[1],dif3[2]-plano4[2],dif3[3]-plano4[3]) ######## paredes tela.pack() janela.mainloop() # #################### return 0
def main(): ############## tkinter criando janelas janela = tkinter.Tk() # canvas_altura = 600 # canvas_largura = 600 # tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura) # ############### ######## paredes plano1 = TP.cria_plano("200 200 400 400") plano2 = TP.cria_plano("150 350 300 450") plano3 = TP.cria_plano("300 150 450 300") plano4 = TP.cria_plano("300 250 350 500") tela.create_rectangle(plano1, width=0, fill="red") tela.create_rectangle(plano2, width=1, fill="blue") #~ tela.create_rectangle(plano3,width=1,fill="green") #~ tela.create_rectangle(plano4,width=1,fill="lightblue") dif1 = TP.sobreposicao_planos(plano1, plano2) print(dif1[0] - plano2[0], dif1[1] - plano2[1], dif1[2] - plano2[2], dif1[3] - plano2[3]) #~ dif2=TP.sobreposicao_planos(plano1,plano3) #~ print(dif2[0]-plano3[0],dif2[1]-plano3[1],dif2[2]-plano3[2],dif2[3]-plano3[3]) #~ dif3=TP.sobreposicao_planos(plano1,plano4) #~ print(dif3[0]-plano4[0],dif3[1]-plano4[1],dif3[2]-plano4[2],dif3[3]-plano4[3]) ######## paredes tela.pack() janela.mainloop() # #################### return 0
def main(): ############## tkinter criando janelas janela = tkinter.Tk() # canvas_altura = 600 # canvas_largura = 620 # tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura) # ############### ######## paredes plano1= TP.cria_plano("0 0 620 10") plano2= TP.cria_plano("0 0 10 600") plano3= TP.cria_plano("610 0 620 600") plano4= TP.cria_plano("0 590 620 600") ################### mapa #~ matriz=[[0]] matriz = [ [0,0,1,1,1,0,0,0,0,0,0],\ [1,1,1,1,1,1,0,0,0,0,0],\ [1,1,1,1,1,1,1,0,0,0,0],\ [1,1,1,1,1,1,1,1,0,0,0],\ [0,1,1,1,1,1,1,1,1,0,0],\ [0,0,1,1,1,1,1,1,1,1,1],\ [0,1,1,1,1,1,1,1,1,1,0],\ [0,1,1,1,1,1,1,1,1,0,0],\ [1,1,1,1,1,1,1,1,0,0,0],\ [1,1,1,1,1,1,1,0,0,0,0],\ [1,1,1,1,1,1,0,0,0,0,0],\ [0,0,1,1,1,0,0,0,0,0,0]] mat = cria_obstaculos(matriz,tela) ################## mapa tela.create_rectangle(plano1,width=0,fill="black") tela.create_rectangle(plano2,width=0,fill="black") tela.create_rectangle(plano3,width=0,fill="black") tela.create_rectangle(plano4,width=0,fill="black") ###barra do jogador: comando = tela.create_rectangle([300,580,400,600],width=0,fill="purple") ######## paredes # bola bola = TB.cria_bola(20,400,500) boll = tela.create_oval(bola,width=1,fill="green") #img = tela.create_image(10,10,image="pkb.png") # bola tela.pack(padx=10, pady=10) ## fisica da bola barra= None vet = "SO" barras=[plano1,plano2,plano3,plano4] tela.delete(boll) while 1: boll = tela.create_oval(bola,width=2,fill="black") ### moldura vet = barras_laterais(barras,boll,vet,tela) ### tijolinhos vet = quebratijolos(mat,boll,tela,vet) ### TB.move_bola(bola,vet) ##comando #~ movecomando(tela,comando) ## tela.update() time.sleep(.005) tela.delete(boll) ## fisica da bola ################### escrevendo janela com tkinter # janela.mainloop() # #################### return 0
def main(): ############## tkinter criando janelas janela = tkinter.Tk() # canvas_altura = 600 # canvas_largura = 620 # tela = tkinter.Canvas(janela, bg="white", width=canvas_largura, height=canvas_altura) # ############### ######## paredes plano1 = TP.cria_plano("0 0 620 10") plano2 = TP.cria_plano("0 0 10 600") plano3 = TP.cria_plano("610 0 620 600") plano4 = TP.cria_plano("0 590 620 600") ################### mapa # ~ matriz=[[0]] matriz = [ [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], ] mat = cria_obstaculos(matriz, tela) ################## mapa tela.create_rectangle(plano1, width=0, fill="black") tela.create_rectangle(plano2, width=0, fill="black") tela.create_rectangle(plano3, width=0, fill="black") tela.create_rectangle(plano4, width=0, fill="black") ###barra do jogador: comando = tela.create_rectangle([300, 580, 400, 600], width=0, fill="purple") ######## paredes # bola bola = TB.cria_bola(20, 400, 500) boll = tela.create_oval(bola, width=1, fill="green") # img = tela.create_image(10,10,image="pkb.png") # bola tela.pack(padx=10, pady=10) ## fisica da bola barra = None vet = "SO" barras = [plano1, plano2, plano3, plano4] tela.delete(boll) while 1: boll = tela.create_oval(bola, width=2, fill="black") ### moldura vet = barras_laterais(barras, boll, vet, tela) ### tijolinhos vet = quebratijolos(mat, boll, tela, vet) ### TB.move_bola(bola, vet) ##comando # ~ movecomando(tela,comando) ## tela.update() time.sleep(0.005) tela.delete(boll) ## fisica da bola ################### escrevendo janela com tkinter # janela.mainloop() # #################### return 0
def main(): ############## tkinter criando janelas janela = tkinter.Tk() # canvas_altura = 600 # canvas_largura = 600 # tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura) # ############### ######## paredes plano1= TP.cria_plano("0 0 600 2") plano2= TP.cria_plano("0 0 2 600") plano3= TP.cria_plano("598 0 600 600") plano4= TP.cria_plano("0 598 600 600") plano_A= TP.cria_plano("200 200 202 600") plano_B= TP.cria_plano("300 300 600 302") tela.create_rectangle(plano_B,width=0,fill="red") tela.create_rectangle(plano_A,width=0,fill="red") tela.create_rectangle(plano1,width=0,fill="red") tela.create_rectangle(plano2,width=0,fill="red") tela.create_rectangle(plano3,width=0,fill="red") tela.create_rectangle(plano4,width=0,fill="red") ######## paredes # bola bola = TB.cria_bola(50,10,100) boll = tela.create_oval(bola,width=0,fill="red") # bola tela.pack() ## fisica da bola barra= None vet = "SE" barras=[plano1,plano2,plano3,plano4,plano_A,plano_B] while 1: for elem in barras: if TP.sobreposicao_planos(bola,elem) != None: barra = TP.direcao_parede(elem) vet = TB.vet_bola(vet,barra) print(vet,barra) TB.move_bola(bola,vet) boll = tela.create_oval(bola,width=2,fill="red") tela.update() time.sleep(.01) #~ if TB.vet_bola(vet,barra) == "NO": #~ tela.move(boll,-1,-1) #~ tela.update() #~ time.sleep(.01) #~ if TB.vet_bola(vet,barra) == "SE": #~ tela.move(boll,1,1) #~ tela.update() #~ time.sleep(.01) #~ if TB.vet_bola(vet,barra) == "SO": #~ tela.move(boll,-1,1) #~ tela.update() #~ time.sleep(.01) ## fisica da bola ################### escrevendo janela com tkinter # janela.mainloop() # #################### return 0