def main(): INVENTARIO.inicia() museu = Museu() mapa = Elemento(img=MAPA, tit="Mapa", style=dict(left=50, top=160, width=200, height="200px")) r_oeste = Cena(img=R_OESTE) mapa.entra(r_oeste) INVENTARIO.bota(mapa) cmapa = Cena(img=MAPA) mapa.vai = cmapa.vai #cenas= [Cena(img=cena) for cena in SALAS.values()] cenas = [ museu.sala_0.leste, museu.sala_0.sul, museu.sala_0.oeste, museu.sala_5.norte, museu.sala_5.leste, museu.sala_7.oeste, museu.sala_9.leste, museu.sala_9.sul, museu.sala_9.sul, museu.sala_A.leste, museu.sala_B.leste, museu.sala_0.norte ] dx, dy = 850 // 6, 650 // 2 marcadores = [ Elemento(img=CIRCULOB, tit=tit, style=dict( left=dx * (x % 6), top=dy * (x // 6), width=dx, height="325px", opacity=0.01, )) for x, tit in enumerate(CENAS) ] for x, marcador in enumerate(marcadores): marcador.entra(cmapa) marcador.vai = cenas[x].vai
def make_piece(index): pc = Elemento(PECAS, x=0, y=0, w=60, h=60, cena=self.cena) pc.siz = (180, 180) dx, dy = 60 * (index // 3), 60 * (index % 3) pc.pos = (-dx, -dy) INV.bota(pc) return pc
def toca(*_): inv.bota(self.e_jero) santo = Texto( local, "Preciso que você ore por mim, para que eu termine a tradução." "Bote o meu retrato em trẽs altares diferentes da gruta e peça que Deus me ilumine", foi=lambda *_: Altares(self.sala, self.atrio, self.sanct)).vai()
def gostou(self, ev, tit, cria, ok): score(casa=[ev.x, ev.y], carta=tit, move="DROP", ponto=ok, valor=cria[9], _level=1) #INVENTARIO.elt.html = tit #INVENTARIO.score(casa=[ev.x, ev.y], carta=[tit], move="DROP", ponto="OK", valor=cria[9], _level=1): #INVENTARIO.elt.html = dict(casa=[ev.x, ev.y], carta=tit, move="DROP", ponto=ok, valor=cria[9], _level=1) #INVENTARIO.elt.html = f"casa={[ev.x, ev.y]}, carta={tit}, move=DROP, ponto={ok}, valor={cria[9]}" INVENTARIO.bota(self.coisas[tit]) if ok else None
def __init__(self): floresta = Cena(FLORESTA) self.fantasma = Cena() floresta.vai() self.galhos = gag = Elemento(img=TRANSPARENTE, tit="galhos", style=dict(left=28, top=130, width=60, height="60px")) gag.entra(floresta) gag.vai = self.fogo_galhos self.pedra = aqua = Elemento(img=TRANSPARENTE, tit="pedras", style=dict(left=500, top=300, width=60, height="60px")) aqua.entra(floresta) aqua.vai = self.fogo_pedra self.oculos = ocu = Elemento(img=OCULOS, tit="OCULOS", style=dict(left=28, top=130, width=60, height="60px")) inv.bota(self.oculos) ocu.vai = self.fogo_oculos
def __init__(self, img, cena): self.cena = cena self.item = Elemento(img=img) self.item_inv = Elemento(img=img) # self.corda_inv.vai=self.mostra_corda inv.bota(self.item_inv) self.item_inv.vai = self.mostra_item self.item.vai = self.some_item
def foi(): historia, _ = self.historia.sai() palavras = len(historia.split()) temas = "peix aqu conch templo".split() tema = sum(1 for palavra in temas if palavra in historia) pontos = palavras + 5 * tema alert("pontos: {}".format(pontos)) if pontos > 10: INVENTARIO.bota(elemento)
def __init__(self, vit): self.vit = vit self.porta = vit.sala.C.sul self.amilase = Elemento(AMILASE, tit="Amilase Sintética", drag=True) self.cola = Elemento(COLA, tit="Cola Glicosada", drop={"Amilase Sintética": self.abre}, cena=self.porta, x=375, y=300, w=75, h=100, style={"opacity": 0.5}) inv.bota(self.amilase)
def _vai(self, ev): self.remaining_shuffle_count -= 1 if not self.remaining_shuffle_count: self.quit() return from browser import document, alert, svg dx, dy = randint(-300, 300), 100 - randint(-100, 100) dy = abs(300 - dx) // 3 dx, dy = 200 - dx, 100 - randint(-dy, dy) #alert (ev.target.id) obj = document[ev.target.id] obj_name = ev.target.id[4:] if obj.getAttribute("data-didit") == "_did_": return if obj_name in self.comida + ["gato"]: food = Elemento('', x=0, y=50, w=200, h=200, tit=f"{ev.target.id}_", cena=self.cena) stag = svg.svg(version="1.1", width="200", height="200") food.elt <= stag #food.tit = f"{ev.target.id}_" stag <= obj obj.setAttribute( 'transform', f"translate(-{ROFFX-485} -{ROFFY-220}) scale(0.60 1.35)") obj.setAttribute( 'transform', f"translate(-{ROFFX-485} -{ROFFY-220}) scale(0.60 1.35)") INV.bota(food) #self.__vai = lambda *_: None obj.setAttribute("data-didit", "_did_") if obj_name == "gato": obj.setAttribute( 'transform', f"translate(-{ROFFX-485} -{ROFFY-345}) scale(0.60 0.6)") food.vai = TheHero().calma TheHero().blacking(food.tit) return TheHero().fishing(food.tit) else: obj.setAttribute( 'transform', f"translate({dx} {dy}) rotate({7*randint(0,70)} {ROFFX} {ROFFY}) scale(2.5)" )
def __init__(self): self.trilha = trilhacaverna = Cena(TRILHACAVERNA) INVENTARIO.inicia() #trilhacaverna.vai() aranha = Elemento(ARANHA, cena=trilhacaverna, x=400, y=150, w=200, h=200) cobra = Elemento(COBRA, cena=trilhacaverna, x=800, y=450, w=400, h=200) setadireita = Elemento(SETADIREITA, cena=trilhacaverna, x=1100, y=450, w=200, h=100) setaesquerda = Elemento(SETAESQUERDA, cena=trilhacaverna, x=30, y=480, w=100, h=100) setadireita.vai = self.dir_vai setaesquerda.vai = cavernaamigo.vai chave = Elemento(CHAVE, cena=trilhacaverna, tit="chave", drag=True, x=500, y=450, w=100, h=50) chave.vai = lambda *_: INVENTARIO.bota(chave)
def __init__(self): self.mochila = Cena(self.MOCHILA) #self.mochila.vai() #self.atp = Elemento(self.ATP, cena=self.mochila) #self.adp = Elemento(self.ADP, cena=self.mochila, x=90) self.moedas = [] self.mochila_inv = Elemento(self.MOCHILA) self.mochila_inv.vai = self.mostra_mochila self.mochila_fecha = Elemento(self.VOLTA, cena=self.mochila, x=0, y=550, w=600, h=50) self.mochila_fecha.vai = self.fecha_mochila self.pega_atp = lambda *_: None inv.bota(self.mochila_inv)
def __init__(self): inv.inicia() self.floresta = floresta = Cena(FLORESTA) self.fantasma = Cena() floresta.vai() self.titulo = 'floresta' self.galhos = gag = Elemento(img=TRANSPARENTE, tit="galhos", style=dict(left=28, top=130, width=60, height="60px")) gag.entra(floresta) gag.vai = self.fogo_galhos self.pedra = aqua = Elemento(img=TRANSPARENTE, tit="pedras", style=dict(left=500, top=300, width=60, height="60px")) aqua.entra(floresta) aqua.vai = self.fogo_pedra self.oculos = ocu = Elemento(img=OCULOS, tit="OCULOS", style=dict(left=28, top=130, width=60, height="60px")) inv.bota(self.oculos) ocu.vai = self.fogo_oculos self.grafico = Elemento(img=TRANSPARENTE, tit="GRÁFICO", style=dict(left=600, top=200, width=300, height="200px")) self.grafico.entra(floresta) inv.score(casa=FLORESTA, carta='', _level=1, move="FLORESTA", ponto=0, valor=0)
def jogo(): """Esta função cria a cena inicial.""" INVENTARIO.inicia() invent = Elemento(img=inventario, tit="inventário", h=200, w=200) INVENTARIO.bota(invent) invent.elt.style.width = "60px" invent.elt.style.height = "60px" quest = Elemento(img=quest_img, tit="quest", h=200, w=200) INVENTARIO.bota(quest) option = Elemento(img=option_img, tit="options", h=200, w=200) INVENTARIO.bota(option) cenaIlha.meio = Cena() # criei uma cena falsa para usar o vai dela cenaIlha.meio.vai = gruta # o vai na verdade chama a função gruta okami1 = Elemento(img=linkOkami1, tit="Okami", y=400, x=170, h=200, w=200) okami1.entra(cenaIlha) waka1 = Elemento(img=linkWaka1, tit="Waka", y=340, x=305, h=250, w=200) waka1.entra(cenaIlha) txtwaka1 = Texto(cenaIlha, "Vamos para a ilha das deusas.") txtokami1 = Texto(cenaIlha, "Oi Waka.") txtokami2 = Texto(cenaIlha, "Então vamos.") textos_okami = [txtokami1, txtokami2] def fala_okami(_): global okami_fala textos_okami[okami_fala].vai() okami_fala -= 1 okami1.vai = fala_okami waka1.vai = txtwaka1.vai ark1 = Elemento(img=linkArk1, tit="Ark", y=450, x=40, h=150, w=500) ark1.entra(cenaIlha) cenaIlha.vai()
def trigonometria(): INVENTARIO.inicia() n_trig = Cena(trig_n) e_trig = Cena(trig_e, esquerda=n_trig) s_trig = Cena(trig_s, esquerda=e_trig) o_trig = Cena(trig_o, esquerda=s_trig, direita=n_trig) n_trig.esquerda, n_trig.direita = o_trig, e_trig s_trig.direita, e_trig.direita = o_trig, s_trig chistyle = dict(left=610, top=140, width=80, maxHeight="90px") globstyle = dict(left=160, top=210, width=80, maxHeight="100px") volcstyle = dict(left=30, top=500, width=100, maxHeight="120px") vdgball = Elemento(ball, tit="earth globe", drag=True, style=chistyle, cena=e_trig, vai=Texto(e_trig, "please, help me, fix my name", foi=lambda: INVENTARIO.bota(vdgball)).vai) eglobe = Elemento(globe, tit="volcano", drag=True, style=globstyle, cena=o_trig, vai=Texto(o_trig, "please, help me, fix my name", foi=lambda: INVENTARIO.bota(eglobe)).vai) volc = Elemento(volcano, tit="glow ball", drop="volcano", style=volcstyle, cena=o_trig, vai=Texto(o_trig, "please, help me, fix my name", foi=lambda: INVENTARIO.bota(eglobe)).vai) txtchildren = Texto(n_trig, "please, help me") e_trig.vai()
def start(self, cena): if TheHero.FISH is not None: return def foi(*_): self.GATEIRA.y = -1000 def vai(ln): yt.elt.html = f'<a href="{ln}" target="_blank"><img src="{YOUTUBE}"></></>' TheHero.GATEIRA = Elemento( GATEIRA, y=-1000, texto="Eu tomo conta dos gatinhos equanto você acha os outros", cena=cena, foi=foi) TheHero.YOUTUBE = Elemento(YOUTUBE, y=-1000, cena=cena, style={"padding": "15px"}) #TheHero.YOUTUBE = Elemento("", tit="YOU TUBE", y =-1000, vai=vai, cena=cena) #yt = TheHero.YOUTUBE #self.cursor = c = Cursor("") #INV.item["gatar"].vai = c.resposta #INV.item["pix"].vai = c.limpa #c.entra(self.cena) TheHero.FISH = f = [f"{fish}_fish" for fish in range(24)] [INV.bota(fish, "https://i.imgur.com/Tjswa4z.png") for fish in f] p_names = "s_luck s_char s_asce s_prot m_keen m_lead m_snea m_cunn b_nimb b_heal b_stre b_pers".split( ) p_names += "p_loot p_levl p_turn p_cats p_xper p_kept p_addr".split() TheHero.PROFILE = {pr: 1 for pr in p_names} TheHero.PROFILE["p_cats"], TheHero.PROFILE["p_kept"] = [], [] for key, value in TheHero.PROFILE.items(): setattr(TheHero, key[2:], property(lambda *_, _tur=self, _k=key: _tur._get_key(_k)) ) #, lambda *_: raise "It is ready only"))
def guardacapa(self, _): INVENTARIO.bota(self.capa_de_chuva)
def ganho(self, valor): """ Aumenta o tesouro com valor equivalente de turquesas :param valor: valor a acrescentar ao tesouro em número de Turquesas. """ self.tesouro += valor [INVENTARIO.bota("turquesa", TURQUESA) for _ in range(valor)]
def guarda(self, _): INVENTARIO.bota(self.faca) self.falou.vai() self.faca.vai = self.usa
def esvazia_mochila(self, _=0): inv.inicia() inv.bota(self.mochila_inv)
def guardacorda(self, _): INVENTARIO.bota(self.corda)
def __init__(self, sala, atrio, sanct): self.jero, self.placa, self.cruz, self.grego, self.vulgata = [ CENA % obj for obj in PROP ] self.icone = icon = Elemento(self.jero, x=360, y=214, w=147, h=250, o=1, tit="icone", drag=True) self.icone.w = 60 self.icone.h = 80 class Altar: def __init__(self, oracao, x, y, ix, iy, cena): self.icone = icon self.oracao_, self.local, self.ix, self.iy = oracao, cena, ix, iy self.altar = Elemento(MARCA, x=x, y=y, w=250, h=150, o=0.2, cena=cena, drop=dict(icone=self.orar)) self.limbo = Cena() def orar(self, *_): def fim(*_): inv.bota(self.icone) self.altar.entra(self.limbo) def bencao(*_): #inv.tira("icone") self.altar.entra(self.limbo) self.icone.entra(self.limbo) Texto( inv.cena, "Que a graça de Nosso Senhor Jesus Cristo esteja com você!" ).vai() "Depois de trinta anos de estudos, consegui terminar a minha tradução da Bíblia" def ora(): oracao = self.oracao_.pop(0) Texto(inv.cena, oracao).vai() return dict(tit=oracao, ) oracao = self.oracao_.pop(0) local = self.local inv.tira("icone") self.icone.entra(local) self.icone.x = self.ix self.icone.y = self.iy self.icone.w = 60 self.icone.h = 80 Texto(local, oracao, foi=lambda *_: fim() if self.oracao_ else bencao()).vai() inv.bota(self.icone) self.oracao = [ "Ó Deus, criador do universo, que vos revelastes aos homens, através dos séculos," " pela Sagrada Eucaristia,", "e levastes o vosso servo, São Jerônimo, a dedicar a sua vida ao estudo e à meditação da Bíblia,", "dai-me a graça de compreender com clareza a vossa palavra quando leio a Bíblia." ] self.altar_estudio = Altar(self.oracao, x=480, y=260, ix=280, iy=240, cena=sala.norte) self.altar_cripta = Altar(self.oracao, x=480, y=260, ix=280, iy=240, cena=sala.oeste) self.altar_nicho = Altar(self.oracao, x=480, y=260, ix=280, iy=240, cena=sala.sul)
def pegaant(self, _): INVENTARIO.bota(self.antidoto)
def fim(*_): inv.bota(self.icone) self.altar.entra(self.limbo)
def __init__(self): C_SUL = C1_SUL C2_SUL = C1_LESTE sala_0 = Sala(R_NORTE, R_LESTE, R_SUL, R_OESTE) sala_1 = Sala(C1_NORTE, C1_LESTE, C_SUL, C1_OESTE) sala_2 = Sala(C2_NORTE, C2_LESTE, C2_SUL, C2_OESTE) sala_3 = Sala(C3_NORTE, C3_LESTE, C3_SUL, C3_OESTE) sala_4 = Sala(C4_NORTE, C4_LESTE, C4_SUL, C4_OESTE) sala_5 = Sala(C5_NORTE, C5_LESTE, C5_SUL, C5_OESTE) sala_6 = Sala(C6_NORTE, C6_LESTE, C6_SUL, C6_OESTE) sala_7 = Sala(C7_NORTE, C7_LESTE, C7_SUL, C7_OESTE) sala_8 = Sala(C8_NORTE, C8_LESTE, C8_SUL, C8_OESTE) sala_9 = Sala(C9_NORTE, C9_LESTE, C9_SUL, C9_OESTE) sala_A = Sala(CA_NORTE, CA_LESTE, CA_SUL, CA_OESTE) sala_B = Sala(CB_NORTE, CB_LESTE, CB_SUL, CB_OESTE) sala_C = Sala(CC_NORTE, CC_LESTE, CC_SUL, CC_OESTE) sala_D = Sala(CD_NORTE, CD_LESTE, CD_SUL, CD_OESTE) sala_E = Sala(CE_NORTE, CE_LESTE, CE_SUL, CE_OESTE) # TEM DOIS SUL DA C9 QUE NA VERDADE ERA PARA SER C8 sala_0.norte.meio = sala_9.leste sala_0.leste.meio = sala_1.norte sala_1.oeste.meio = sala_2.norte sala_1.sul.meio = sala_0.oeste sala_2.norte.meio = sala_A.norte sala_A.norte.meio = sala_3.norte sala_A.sul.meio = sala_1.leste sala_3.norte.meio = sala_4.norte sala_3.sul.meio = sala_A.sul sala_4.oeste.meio = sala_5.norte sala_4.sul.meio = sala_3.sul sala_5.leste.meio = sala_6.norte sala_5.oeste.meio = sala_C.norte sala_5.sul.meio = sala_4.leste sala_6.sul.meio = sala_5.oeste sala_C.norte.meio = sala_D.norte sala_C.sul.meio = sala_5.leste sala_D.norte.meio = sala_7.norte sala_D.sul.meio = sala_C.sul sala_D.norte.meio = sala_E.norte sala_6.leste.meio = sala_B.norte sala_B.sul.meio = sala_6.oeste sala_7.leste.meio = sala_8.norte sala_7.sul.meio = sala_E.leste sala_8.leste.meio = sala_9.norte sala_8.sul.meio = sala_7.oeste sala_9.sul.meio = sala_8.sul sala_9.oeste.meio = sala_0.sul sala_9.sul.meio = sala_8.oeste sala_E.oeste.meio = sala_7.norte sala_E.sul.meio = sala_D.sul dino = Elemento(img=DINO, tit="Dino", style=dict(left=50, top=160, width=200, height=200)) dino.entra(sala_2.leste) def botainventario(): INVENTARIO.bota(dino) dinotexto = Texto(sala_2.leste, "e ai,colega, tudo tranks?", foi=botainventario) dino.vai = dinotexto.vai def recobra(_): INVENTARIO.cena._code_.elt.style = { "visibility": "visible", "opacity": 1 } INVENTARIO.inicia() interrogacao = Elemento(interrogacao_, cena=INVENTARIO, tit="Tutorial", vai=recobra, style=dict(left=100, top=100, width=100, height="100px")) interrogacao.entra(INVENTARIO) INVENTARIO.bota(interrogacao) video = Video(source="https://www.w3schools.com/html/mov_bbb.mp4", width="320", height="240", top=0, left=0) video.entra(sala_0.norte) #video=html.VIDEO(width="320", height="240",autoplay=True, style=dict(position="absolute", top=0, left=0)) #video<=html.SOURCE(src="https://www.w3schools.com/html/mov_bbb.mp4") #sala_0.norte.elt<=video #sala_0.norte.vai = sala_1.norte.vai() sala_0.norte.vai() # cod = Codigo(cena=sala_0.norte ,topo= "ola", codigo = "if True:print('oi')",style = dict(width=400,heigth="250px",left=500,top=100)) # cod = Codigo(cena=sala_1.norte, topo = "hello",codigo = "if True:print('ooi')",style = dict(width=400,heigth="250px",left=500,top=100)) # cod = Codigo(cena=sala_1.leste, topo = "Bonju",codigo = "if True:print('ooi')",style = dict(width=400,heigth="250px",left=500,top=100)) # cod = Codigo(cena=sala_1.oeste, topo = "Buenos dias",codigo = "if True:print('ooi')",style = dict(width=400,heigth="250px",left=500,top=100)) # cod =Codigo(cena=sala_1.sul, topo = "como vai?",codigo = "if True:print('ooi')",style = dict(width=400,heigth="250px",left=500,top=100)) MENSAGENS = [ [ sala_0.norte, "Olá! Se prepare, que finalmente chegou o dia de aprender a programar em Python. Vamos embarcar nessa aventura já! Crie uma cena utilizando o código abaixo. ", """from _spy.vitollino.main import Cena link_para_uma_imagem = "https://i.imgur.com/IPa06hM.jpg" uma_cena=Cena(link_para_imagem) uma_cena.vai""" ], [ sala_0.leste, "Agora que você já conseguiu programar sua primeira cena, que tal acrescentar uma nova e poder navegar entre elas com um clique à direita da imagem?", """from _spy.vitollino.main import Cena link_para_primeira_imagem = "https://i.imgur.com/IPa06hM.jpg" link_para_segunda_imagem = "https://i.imgur.com/rHzbmtM.jpg" primeira_cena=Cena(link_para_primeira_imagem) segunda_cena=Cena(link_para_segunda_imagem) primeira_cena.direita = segunda_cena primeira_cena.vai() """ ], [ sala_0.sul, "Depois de aprender a acrescentar uma nova cena, você agora pode criar um cômodo completo! Utilize o código abaixo para criar as quatro cenas que formarão um cômodo inteiro.", """from _spy.vitollino.main import Cena link_para_primeira_imagem = "https://i.imgur.com/IPa06hM.jpg" link_para_segunda_imagem = "https://i.imgur.com/rHzbmtM.jpg" link_para_terceira_imagem = "https://i.imgur.com/NnVA765.jpg" link_para_quarta_imagem = "https://i.imgur.com/XJXjA9r.jpg" primeira_cena=Cena(link_para_primeira_imagem) segunda_cena=Cena(link_para_segunda_imagem) terceira_cena=Cena(link_para_terceira_imagem) quarta_cena=Cena(link_para_quarta_imagem) primeira_cena.direita = segunda_cena segunda_cena.esquerda = primeira_cena segunda_cena.direita = terceira_cena terceira_cena.esquerda = segunda_cena terceira_cena.direita = quarta_cena quarta_cena.esquerda = terceira_cena quarta_cena.direita = primeira_cena primeira_cena.esquerda = quarta_cena primeira_cena.vai() """ ], [ sala_0.oeste, "Achou o código para montar o cômodo grande? Saiba que há uma maneira de fazer o mesmo trabalho em poucas linhas, através da função Sala. Confira testando o código abaixo:", """from _spy.vitollino.main import Sala primeira_cena = "https://i.imgur.com/IPa06hM.jpg" segunda_cena = "https://i.imgur.com/rHzbmtM.jpg" terceira_cena = "https://i.imgur.com/NnVA765.jpg" quarta_cena = "https://i.imgur.com/XJXjA9r.jpg" sala = Sala(primeira_cena, segunda_cena, terceira_cena, quarta_cena) sala.norte.vai() """ ], [sala_1.norte, "Hello", "if True:print('ooi')"], [sala_1.leste, "bonju", "if True:print(':)')"], [sala_1.oeste, "Buenos dias", "if True:print('oi')"], [sala_1.sul, "como vai?", "if True:print('oi')"], [sala_2.norte, "Bora lá?", "if True:print('oi')"], [sala_2.leste, "vamos?", "if True:print('oi')"], [sala_2.oeste, "lest go", "if True:print('oi')"], [sala_2.sul, "vamonos", "if True:print('oi')"], [sala_3.norte, "como estas?", "if True:print('oi')"], [sala_3.leste, "e o dia?", "if True:print('oi')"], [sala_3.oeste, "ta calor?", "if True:print('oi')"], [sala_3.sul, "quanto graus está agora?", "if True:print('oi')"], [sala_4.norte, "hey", "if True:print('oi')"], [sala_4.leste, "parabéns", "if True:print('oi')"], [sala_4.oeste, "você chegou até aqui!", "if True:print('oi')"], [sala_4.sul, "tenha muito orgulho de vc", "if True:print('oi')"], [ sala_5.norte, "temos que comemorara pequenas vitórias", "if True:print('oi')" ], [sala_5.leste, "está indo muito bem", "if True:print('oi')"], [ sala_5.oeste, "tudo que fizer coloque amor", "if True:print('oi')" ], [sala_5.sul, "se ame", "if True:print('oi')"], [sala_6.norte, "se cuide", "if True:print('oi')"], [sala_6.leste, "hoje o dia esta lindo", "if True:print('oi')"], [ sala_6.oeste, "deixe a chuva lavar a alma", "if True:print('oi')" ], [sala_6.sul, "hasta la vista", "if True:print('oi')"], [sala_7.norte, " you say goodbye", "if True:print('oi')"], [sala_7.leste, "and say Hello", "if True:print('oi')"], [sala_7.oeste, "acredite em vc", "if True:print('oi')"], [sala_7.sul, "vc é capaz", "if True:print('oi')"], [sala_8.norte, "don't worry", "if True:print('oi')"], [sala_8.leste, "vc é capaz", "if True:print('oi')"], [sala_8.oeste, " be free", "if True:print('oi')"], [sala_8.sul, "está quase acabando", "if True:print('oi')"], [ sala_9.norte, "você esta vencendo seus medos", "if True:print('oi')" ], [sala_9.leste, "está se superando", "if True:print('oi')"], [sala_9.oeste, "respire", "if True:print('oi')"], [sala_9.sul, "comemore, pois vc venceu", "if True:print('oi')"], [sala_A.norte, "tudo vai bem", "if True:print('oi')"], [sala_A.leste, "não desista", "if True:print('oi')"], [sala_A.oeste, "não é tão complicado", "if True:print('oi')"], [sala_A.sul, "avai sim", "if True:print('oi')"], [sala_B.norte, "tudo vai bem", "if True:print('oi')"], [sala_B.leste, "não desista", "if True:print('oi')"], [sala_B.oeste, "não é tão complicado", "if True:print('oi')"], [sala_B.sul, "avai sim", "if True:print('oi')"], [sala_C.norte, "tudo vai bem", "if True:print('oi')"], [sala_C.leste, "não desista", "if True:print('oi')"], [sala_C.oeste, "não é tão complicado", "if True:print('oi')"], [sala_C.sul, "avai sim", "if True:print('oi')"], [sala_D.norte, "tudo vai bem", "if True:print('oi')"], [sala_D.leste, "não desista", "if True:print('oi')"], [sala_D.oeste, "não é tão complicado", "if True:print('oi')"], [sala_D.sul, "avai sim", "if True:print('oi')"], [sala_E.norte, "tudo vai bem", "if True:print('oi')"], [sala_E.leste, "não desista", "if True:print('oi')"], [sala_E.oeste, "não é tão complicado", "if True:print('oi')"], [sala_E.sul, "avai sim", "if True:print('oi')"] ] STYLE = dict(width=400, heigth="250px", left=400, top=100) [ Codigo(cena=a, topo=b, codigo=c, style=STYLE) for a, b, c in MENSAGENS ]
def jogo(): INVENTARIO.inicia() invent = Elemento(img=linkInventario, tit="Inventário", h=200, w=200) INVENTARIO.bota(invent) mapa = Elemento(img=linkMapa, tit="Mapa", h=200, w=200) INVENTARIO.bota(mapa) quests = Elemento(img=linkQuests, tit="Quests", h=150, w=150) INVENTARIO.bota(quests) espada = Elemento(img=linkEspadaicone, tit="espada", h=200, w=200) INVENTARIO.bota(mapa) cenaIlha = Cena(img="https://i.imgur.com/5UvVC5M.png") cena_gruta = Cena(img=linkGruta1) cena_blockhead = Cena(img=linkCenablockhead) cenaIlha.meio = cena_gruta okami1 = Elemento(img=linkOkami1, tit="Okami", y=400, x=170, h=200, w=200) okami1.entra(cenaIlha) waka1 = Elemento(img=linkWaka1, tit="Waka", y=340, x=305, h=250, w=200) waka1.entra(cenaIlha) txtwaka1 = Texto(cenaIlha, "Vamos para a ilha das deusas.") waka1.vai = txtwaka1.vai ark1 = Elemento(img=linkArk1, tit="Ark", y=400, x=40, h=200, w=500) ark1.entra(cenaIlha) rat1 = Elemento(img=linkRat1, tit="Rat godess", y=150, x=420, h=400, w=400) rat1.entra(cena_gruta) txtrat1 = Texto( cena_gruta, "afie minha espada mas por um porem prove sue valor completando ésa missão." ) rat1.vai = txtrat1.vai ark2 = Elemento(img=linkArk2, tit="Ark", y=350, x=830, h=100, w=100) ark2.entra(cena_gruta) ark2.vai = cenaIlha.vai okami1 = Elemento(img=linkOkami1, tit="Okami", y=400, x=170, h=200, w=200) okami1.entra(cena_gruta) waka1 = Elemento(img=linkWaka1, tit="Waka", y=340, x=890, h=250, w=200) waka1.entra(cena_gruta) txtwaka1 = Texto(cena_gruta, "Vamos fazer a missão.") waka1.vai = txtwaka1.vai espada1 = Elemento(img=linkEspada1, tit="espada", y=340, x=450, h=200, w=200) espada1.entra(cena_gruta) espada1.vai = cena_blockhead.vai return1 = Elemento(img=linkReturn1, tit="Return", y=50, x=50, h=100, w=100) return1.entra(cena_blockhead) return1.vai = cena_gruta.vai secretroom = Elemento(img=linksecretroom, tit="ester egg", y=350, x=830, h=100, w=100) secretroom.entra(cena_gruta) secretroom.vai = cenaIlha.vai cena_gruta.vai()
def botainventario(): INVENTARIO.bota(dino)
def catching(self, cat): TheHero.PROFILE['p_cats'].append(cat) #INV.bota(cat.tit,cat.face) self.learn(self.levl * 10) INV.bota(cat)
def clicounaletra(self, ev): #INVENTARIO.bota(self.mapa[ev.target.id]) INVENTARIO.bota(Elemento(globals()[f"LETRA_{ev.target.id}"])) self.palavramontada += ev.target.id
def vai(self): def maybe(pos, rua, collection): return pos + collection.pop() if R[rua] in Z else pos #h = TheHero() self.gatar = g = Elemento(GATAR, tit="gatar", x=200, y=550, w=100, h=100) #, vai=h.resposta) self.pix = p = Elemento(PIX, tit="pix", x=200, y=550, w=100, h=100) #, vai=h.limpa) #self.et = Elemento(GITRAW, x=500, y=200, w=100, h=100, cena=sala_b.norte) #x = Elemento('', x=0, y=0, w=1000, h=800, cena=sala_b.norte)#, vai=self.et_vai) '''[111, 535, 106, 104] [503, 414, 77, 50] ''' INV.inicia() INV.bota(g) INV.bota(p) G = [0] * 15 + [-2000] * (4 * 9 - 15) Y = [0] * 25 + [-2000] * (4 * 9 - 25) T = G[:] #*_ = shuffle(G) shuffle(Y) shuffle(T) C = "Norte Leste Sul Oeste".split() R = "JUDITE FLAVIANO TARGINO GERALDO MENDES RIBEIRO ESPERANÇA HOLMES CARLOS ANTÔNIO".split( ) Z = "JUDITE FLAVIANO TARGINO GERALDO ESPERANÇA HOLMES CARLOS ANTÔNIO".split( ) sala_a_img = [IM.format(lnk) for lnk in SA] # SI1, SI2, SI3, SI4, SI5, SI6, SI7, SI8, SI9 = [[IM.format(lnk) for lnk in sala_] for sala_ in SALAS] salas_imgs = [[IM.format(lnk) for lnk in sala_] for sala_ in SALAS] salas_args = [[ Rua(sala, self.trash, [(P.H, [200, 550]), (P.S, [1043, maybe(573, rua, G)]), (P.P, [f"RUA {R[rua]} {C[canto]}"]), (P.T, [863, maybe(453, rua, T), 50, 50]), (P.G, [150, maybe(403, rua, Y), 60, 60])]) for canto, sala in enumerate(sala_img) ] for rua, sala_img in enumerate(salas_imgs)] SAI1, SAI2, SAI3, SAI4, SAI5, SAI6, SAI7, SAI8, SAI9 = salas_args # alert(SAI6) sala_a_args = SAI5 #[Rua(sala, self.trash,[(P.H, [200, 550])]) for sala in sala_a_img] sala_a_args[0] = Rua(sala_a_img[0], self.trash, [(P.P, [f"RUA MENDES {C[0]}"]), (P.H, [201, 428]), (P.T, [801, 409, 36, 36]), (P.S, [1043, 473 + G.pop()])]) sala_a_args[1] = Rua(sala_a_img[1], self.trash, [(P.P, [f"RUA MENDES {C[1]}"]), (P.H, [340, 518]), (P.G, [789, 453, 47, 43]), (P.T, [863, 453, 34, 40]), (P.T, [918, 499, 25, 32]), (P.T, [1011, 548, 42, 48])]) sala_a_args[2] = Rua(sala_a_img[2], self.trash, [(P.P, [f"RUA MENDES {C[2]}"]), (P.H, [272, 534]), (P.T, [498, 414, 89, 47]), (P.G, [827, 384, 40, 40]), (P.S, [981, 454 + G.pop()])]) sala_a_args[3] = Rua(sala_a_img[3], self.trash, [(P.P, [f"RUA MENDES {C[3]}"]), (P.H, [111, 535]), (P.T, [503, 414, 77, 50]), (P.T, [890, 430, 61, 25]), (P.G, [662, 404, 50, 41]), (P.S, [969, 473 + G.pop()])]) sala_b_args = [IM.format(lnk) for lnk in SB] sala_b_args[0] = Rua(sala_b_args[0], self.trash, [(P.P, [f"RUA RIBEIRO {C[0]}"]), (P.H, [200, 550]), (P.T, [540, 440]), (P.T, [840, 470]), (P.T, [397, 559, 50, 50]), (P.S, [1050, 550 + G.pop()]), (P.G, [484, 400, 48, 44])]) sala_b_args[1] = Rua(sala_b_args[1], self.trash, [(P.P, [f"RUA RIBEIRO {C[1]}"]), (P.H, [310, 490]), (P.T, [540, 490]), (P.T, [780, 430, 150]), (P.G, [60, 510, 100]), (P.S, [980, 500 + G.pop()])]) sala_b_args[2] = Rua(sala_b_args[2], self.trash, [(P.P, [f"RUA RIBEIRO {C[2]}"]), (P.H, [100, 500]), (P.T, [780, 590, 60, 50]), (P.T, [840, 670]), (P.S, [850, 550 + G.pop()]), (P.G, [390, 510, 80, 140])]) sala_b_args[3] = Rua(sala_b_args[3], self.trash, [(P.P, [f"RUA RIBEIRO {C[3]}"]), (P.H, [300, 600]), (P.T, [650, 440, 60, 50]), (P.T, [910, 470, 220, 120]), (P.T, [1140, 610, 90]), (P.S, [850, 550 + G.pop()])]) SI1, SI2, SI3, SI4, SI5, SI6, SI7, SI8, SI9 = [ Sala(*sala_) for sala_ in salas_args ] SI6 = sala_b = Sala(*sala_b_args) SI5 = sala_a = Sala(*sala_a_args) lab0 = Labirinto(sala_a, sala_b, sala_b, sala_b, sala_b) lab1 = Labirinto(sala_b, sala_a, sala_a, sala_a, sala_a) Labirinto(SI5, SI8, SI6, SI2, SI4) Labirinto(SI6, SI9, SI4, SI3, SI5) Labirinto(SI8, SI2, SI9, SI5, SI7) Labirinto(SI9, SI3, SI7, SI6, SI8) Labirinto(SI1, SI4, SI2, SI7, SI3) Labirinto(SI2, SI5, SI3, SI8, SI1) Labirinto(SI4, SI7, SI5, SI1, SI6) # self.cena = c = Elemento(WIND, x=0, y=0, w=1350, h=800, o=0.4, cena=sala_b.norte) # self.rain = r = Elemento(HAIL, x=0, y=0, w=1350, h=800, o=0.4, cena=sala_b.norte) # self.hero = h = Elemento(PETUNIO, x=200, y=550, w=130, h=100, cena=sala_b.norte) # self.stray = s = Elemento(IMP.format(STRAY[0]), x=600, y=550, w=130, h=100, cena=sala_b.norte) # self.strays = z = Elemento(IMP.format(STRAYS[0]), x=300, y=50, w=650, h=650, cena=sala_b.norte) sala_b.norte.vai()
def guarda(self, _): INVENTARIO.bota(self.lanterna)