[Python] Making a game on phone in python [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I basically have this code that I made on a sleepover. I am trying to use Pydroid3 to make this text called as code work its magic.

    import random
    import time
    import pygame

    pygame.mixer.init()

    pygame.mixer.music.load("/sdcard/Alarms/we-are-the-champions-copia.mp3")

    def dobni():#to throw
    global ABC
    a=random.randint(1,6)
    b=random.randint(1,6)
    n=random.randint(1,6)
    c=1
    for i in range(1,n+1):
    c=c*2
    ABC=a+b+c
    print("Ennyit dobtál, "+str(j)+". játékos:"+str(a)+" + "+str(b)+" + "+str(c)+" = "+str(ABC)) #You threw this much:
    time.sleep(0.5)

    def game():
    global j
    global win
    while win==False:
    for j in range(1,int(players)+1):
    print("----------------------------------------------")
    time.sleep(0.5)
    dobni()
    list[j]=list[j]+ABC
    print("Az összpontszámod: "+str(list[j]))#Your points
    time.sleep(0.5)

    if list[j]==100:
    win=True
    print(str(j)+". játékos nyert!")#j player wins
    pygame.mixer.music.play()

    if list[j]>100:
    list[j]=100-(list[j]-100)
    print("Vagyis:"+str(list[j]))

    players = 56
    time.sleep(1)
    print("Jegyezd meg hogy ki hányadik játékos, mert én nem fogom")#not important at all for you
    list=[0]*(int(players)+1)
    win=False
    game()


    I want to see the text that is output. I could not use input(),said chatGPT so I just made it be 56 for no reason. I just want the sound to play when someone wins this "game".

    Continue reading...

Compartilhe esta Página