def _entra(self, *_): self._entra_sai= self._sai self._doggie_sobe = lambda:self._move_doggie(100) self._doggie_desce = lambda:self._move_doggie(400) self.na_cesta="doggie" self.doggie.elt.style.left = 300 INVENTARIO.score(casa="doggie", carta=self.na_cesta, move="entra", ponto=0, valor=0, _level=1)
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 __init__(self): super().__init__(CENA_PESCARIA) pescaria = self self.peixe=[{}]*3 INVENTARIO.inicia() participante = input("diga seu nome") score(carta=participante, casa="pescaria", move="JULIA", _level=0) Peixe1(pescaria, x=550, y=505) Peixe2(pescaria, x=280, y=505) Peixe3(pescaria, x=590, y=440) Peixe4(pescaria, x=460, y=420) Peixe5(pescaria, x=420, y=490) Peixe6(pescaria, x=400, y=405) Peixe7(pescaria, x=480, y=505) Peixe8(pescaria, x=390, y=505) Peixe9(pescaria, x=620, y=465) Peixe10(pescaria, x=520, y=465) Peixe11(pescaria, x=330, y=500) Peixe12(pescaria, x=650, y=440) Peixe13(pescaria, x=230, y=510) Peixe14(pescaria, x=530, y=425) Peixe15(pescaria, x=420, y=450) #Jarra(pescaria) #Jarra(pescaria, x=200, y=230) Balde(pescaria, nome="balde grande", tipo_peixe="grande", x=285, y=380) Balde(pescaria, nome="balde pequeno", tipo_peixe="pequeno", x=15, y=410) Balde(pescaria, nome="balde médio", tipo_peixe="médio", x=720, y=460) Balde(pescaria, nome="balde pequeno", tipo_peixe="pequeno", x=800, y=415) Crianca(pescaria, tit="marcos", x=180, y=280) Crianca(pescaria, tit="julia", x=720, y=250) pescaria.vai()
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 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 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 __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 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 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()
def _sai(self, *_): self._entra_sai= self._entra self._doggie_sobe = lambda:None self._doggie_desce = lambda:None self.na_cesta="nada" self.doggie.elt.style.left = 350 INVENTARIO.score(casa="doggie", carta=self.na_cesta, move="sai", ponto=0, valor=0, _level=1)
def pontua(self, pontos): resposta, grafo = pontos #grafo = [t for data in grafo.split(chr(172)) for _, t in data.split(chr(181))] grafo_ = Plotter.unpack(grafo) t0 = int(grafo_[0][1]) grafo = [(int(t) - t0) // 10 for _, t in grafo_] _grafo = [(x, b - a) for x, (b, a) in enumerate(zip(grafo[1:], grafo))] _grafp = [(x, b - a + 100) for x, ((_, b), (_, a)) in enumerate(zip(_grafo[1:], _grafo)) ] plt = Plotter(self.grafico.elt, self.titulo) x, y = zip(*_grafo) plt.plot(x, y) x, y = zip(*_grafp) plt.plot(x, y, "magenta") paradigma, parax = avaliar(resposta) sintagma, sintax = responde(resposta, SUJEITOS, VERBOS, OBJETOS) sintax, parax = Plotter.pack(sintax), Plotter.pack(parax) display_paradigma = "paradigma={}::{}".format(paradigma, parax) plt.display(display_paradigma) display_sintagma = "sintagma={}::{}".format(sintagma, sintax) plt.display(display_sintagma) datapack = Plotter.pack([[c, '{0:0>6}'.format((int(t) - t0) // 1)] for c, t in grafo_]) inv.score(casa=resposta, carta=datapack, _level=2, move=self.titulo, ponto=display_paradigma, valor=display_sintagma)
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): """ Constroi a cena""" INVENTARIO.inicia() self.acampamento = Acampamento(ACAMPAMENTO) self.eu = Jogador() self.tumba = Tumba(self.acampamento, self.eu) self.cena_do_templo = Cena( IMAGEM_DO_TEMPLO, self.acampamento, direita=self.tumba.inicial) self.acampamento.direita = self.cena_do_templo
def __init__(self): inv.inicia() cena = Cena(CENA % CENAS) self.jero, self.placa, self.cruz, self.grego, self.vulgata = [ CENA % obj for obj in PROP ] self.pano, self.livro = [CENA % obj for obj in MPROP] self.capel = capel = [Cena(CENA % parede) for parede in CAPEL] self.sala = sala = Sala(*[CENA % parede for parede in CENAS]) self.atrio = atrio = Sala(*[CENA % parede for parede in INTER]) self.sanct = sanct = Sala(*[CENA % parede for parede in SANCT]) #cena.vai() cave = Labirinto(c=atrio, n=sanct, s=sala) # capel[0].meio = capel[1] capel[0].meio = Cena(vai=self.sao_jeronimo) capel[1].meio = capel[1].esquerda = capel[1].direita = sala.norte #capel[0].vai() #atrio.leste.vai() #sanct.leste.vai() self.e_limbo = Cena("") self.e_grego = Elemento(self.grego, x=510, y=210, w=280, vai=self.rasga) self.e_placa = Elemento(self.placa, x=510, y=210, w=280, cena=atrio.leste) self.e_jero = Elemento(self.jero, x=360, y=214, w=147, h=250, cena=sanct.leste, tit="icone", drag=True) #self.e_jero = Elemento(self.pano, x=360, y=212, w=150, h=250, cena=sanct.leste) self.e_jerom = Elemento(JEROM, x=0, y=400, w=150, h=250, cena=sanct.leste) self.e_vecruz = Elemento(MARCA, x=480, y=100, w=150, h=250, o=0.1, cena=capel[0], vai=self.sao_jeronimo) self.e_vecruz.o = 0.2 self.sao_jeronimo()
def __init__(self, cena=None): inv.inicia() self.mochila = cena or Cena(img=MOCHILA) self.mochila.vai() self.corda = Item(img=CORDA, cena=self.mochila) self.faca = Item(img=FACA, cena=self.mochila) self.fogo = Item(img=FOGO, cena=self.mochila) self.kit = Item(img=KIT, cena=self.mochila) self.mapa = Item(img=MAPA, cena=self.mochila) self.bussula = Item(img=BUSSULA, cena=self.mochila)
def move(self, casa_destino): self.elemento.elt.style.left, self.elemento.elt.style.top = casa_destino.local( ) self.casa = casa_destino.nome INVENTARIO.score(casa=casa_destino.nome, carta=self.nome, move="MOVE", ponto=self.crivo(), valor="N", _level=3)
def __init__(self): global PERIGOS PERIGOS ={} INVENTARIO.inicia() #INVENTARIO.bota(tur) self.acampamento = Acampamento() self.jogador = Jogador(self.acampamento) self.baralho = Carta(self.jogador).baralho() self.templo = Cena(DI["TEMPLO"]) #self.templo = Perigo(tipo="TEMPLO", imagem=DI["TEMPLO"]) self.templo.direita = self.baralho[1]
def score(self, valor, vai=False): INVENTARIO.score(casa="centro_9_9", carta="carta_99", move="INICIA", ponto=0, valor=valor, _level=2) if vai: self.inicia_fase() else: Jogo.JOGO.reset()
def remover_carta(self, ev): carta_elt = ev.target.parent_id doc[carta_elt].remove() self.cria_carta(carta_elt) INVENTARIO.score(casa=self.casa, carta=carta_elt, move="REMOVE", ponto=-1, valor="N", _level=3) ev.stopPropagation() return False
def __init__(self): 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 self.cena = Cena(ARVORE) INV.inicia() self.cena.vai() self.pecas = [make_piece(index) for index in range(9)]
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 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 _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): predio = Cena(PREDIO) predio.vai() # Musica("https://raw.githubusercontent.com/kwarwp/anita/master/bensound-creativeminds.mp3") self._sobe_desce = self._desce self._entra_sai = self._entra self._doggie_sobe_desce = lambda *_:None self._doggie_desce = lambda *_:None self._doggie_sobe = lambda *_:None self.na_cesta = "nada" self.cesta = Elemento(CESTA, x=300, y=100,w=180,h=180, cena=predio, vai=self.sobe_desce) self.doggie = Elemento(Doggie, x=350, y=80, cena=predio, vai=self.entra_sai) INVENTARIO.score(casa="elevador", carta=self.na_cesta, move="desce", ponto=0, valor=0, _level=0) a = Texto(predio, "oi", foi=lambda op="YY": Texto(predio, f"escolheu {op}").vai(), A="ee", B="uu") a.vai()
def cria_tabuleiro(self, col=3, lin=4, lado="e"): INVENTARIO.score(casa="centro_9_9", carta="carta_99", move="INICIA", ponto=0, valor="N", _level=1) self.casa["esquerda"] = {} for coluna_ in range(col): for linha_ in range(lin): nome = "{}_{}_{}".format(linha_, coluna_, lado) self.casa["esquerda"][nome] = Casa(self, nome=nome, linha=linha_, coluna=coluna_, lado=lado)
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.fundo = Cena(ITEM["FLORESTA"]) self.maca = Elemento(ITEM["MACA"], tit="maçã", style=dict(height=60, widht=60, left=600, top=20), cena=self.fundo, vai=self.guarda_item) self.laranja = Item(ITEM["LARANJA"], tit="laranja", style=dict(height=60, widht=60, left=100, top=100), cena=self.fundo) self.laranja.mementor((110, 150, 200, "200px")) self.laranja.vai = self.laranja.bota self.fundo.vai()
def Historia(): INVENTARIO.inicia() cenaMaracana = Cena(MARACANA) elementoFlamengo = Elemento(img=FLAMENGO, tit="Torcida do Flamengo", style=dict(left=150, width=60, heigth=70)) elementoBola = Elemento(img=BOLA, tit="Bola" style=dict(left=100, widht=40, height=50)) elementoFlamengo.entra(cenaMaracana) elementoBola.entra(cenaMaracana) def botainventario(): INVENTARIO.bota(elementoBola) txtflamengo = Texto(cenaMaracana, "Vamos Flamengo", foi=botainventario) elementoFlamengo.vai =txtflamengo.vai cenaBAR = Cena(BAR, direita=cenaMaracana) cenaMaracana.esquerda = cenaBAR cenaMaracana.vai()
def Historia(): INVENTARIO.inicia() cenaArgentina = Cena(ARGENTINA) elementoTango = Elemento(img=TANGO, tit="Casal", style=dict(left=180, top=30, width='120px', height='260px')) elementoTango.entra(cenaArgentina) def botainventario(): INVENTARIO.bota(elementoTango) txttango = Texto(cenaArgentina, "Quem dança seus males espanta!", foi=botainventario) elementoTango.vai = txttango.vai cenaSamba = Cena(SAMBA, direita=cenaArgentina) cenaArgentina.esquerda = cenaSamba cenaArgentina.vai()