2
I would like to make this hangman game work in a window, I would like to do it in a way that my daughter can play, I’m still learning, follow the code:
import pygame
from pygame.locals import*
from sys import exit
pygame.init()
largura = 640
altura = 640
tela = pygame.display.set_mode((largura,altura))
pygame.display.set_caption("Jogo da Lala")
def draw():
display.fill([19, 173, 235])
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
exit()
pygame.display.update()
import emoji
print(emoji.emojize(':girl: Joguinho da Larissa :girl:'))
print('\n')
print('Oi meu nome é Larissa, mas todo mundo me chama de "LALA".')
while True:
resp = input(emoji.emojize('Vamos brincar de forca? :skull:'))
if resp == 'yes' or resp == 'sim' or resp == 'y' or resp == 's':
print('Que legal, então vamos começar!')
break
if resp == 'não' or resp == 'no' or resp == 'n':
print(emoji.emojize('Que pena! :sob:'))
import sys
import random
def run():
print("Digite uma letra:")
wordbank = ["casa", "abacate", "amor", "tatiane", "walles", "larissa", "familia", "lilica", "cachorro", "gato",
"bicicleta", "televisao", "violao", "samuel", "vovo", "ian", "sol", "dia", "chocolate", "boneca",
"carro", "luluca", "aviao", "telefone", "celular", "dormir", "estudar"]
word = random.choice(wordbank)
guesses = " "
turns = 10
while turns > 0:
failed = 0
for char in word:
if char in guesses:
print(char)
else:
print("_")
failed += 1
if failed == 0:
print("Você venceu!!! Parabéns")
choice = input("Quer jogar novamente y/n\n")
if "y" or "s" or "sim" in choice:
run()
elif "n" or "nao" in choice:
sys.exit()
else:
print("Deu algo errado, digite s or n.")
guess = input("Digite uma letra:")
guesses += guess
if guess not in word:
turns -= 1
print("Errou!")
print(f"Você tem mais {turns} tentativas.")
if turns == 0:
print("Você perdeu!")
choice = input("Quer jogar novamente s/n\n")
if "y" or "s" in choice:
run()
elif "n" in choice:
sys.exit()
else:
print("Deu algo errado, digite s or n.")
run()
Where she will play this game, on a PC with Windows/Linux/Macos, Mobile/Tablet Android/IOS
– Augusto Vasques
would be cool if it were by phone, android
– Walles Larissa Tatiane
See if help https://python-for-android.readthedocs.io/en/latest/quickstart/ is the documentation for Python for Android.
– Augusto Vasques
I’ll look, thank you
– Walles Larissa Tatiane