Example #1
0
def ChooseMoney():  # Hàm chọn số tiền cá cược
    betting = 0
    comment = font.render('CHOOSE AMOUNT OF YOUR BET', 1, (3, 252, 244))
    back = Head.button(1, 1, 'BACK')
    while betting == 0:
        screen.blit(BG_choose, (0, 0))
        screen.blit(comment, (290, 400))
        if Money_option1.draw_button():
            if Head.money >= 100:
                pygame.mixer.music.load('sound/button.mp3')
                pygame.mixer.music.play(1)
                betting = 100
        elif Money_option2.draw_button():
            if Head.money >= 200:
                pygame.mixer.music.load('sound/button.mp3')
                pygame.mixer.music.play(1)
                betting = 200
        elif Money_option3.draw_button():
            if Head.money >= 400:
                pygame.mixer.music.load('sound/button.mp3')
                pygame.mixer.music.play(1)
                betting = 400
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

        pygame.display.update()
    return betting
Example #2
0
def Spell(k, i, vitri):
    y = 360 + 70 * i
    x = 500 + vitri * 50 - 100 * vedich
    #DISPLAYSURF.blit(pygame.image.load(k), (x,y))
    return x


def Random():
    return random.choice([
        'Spell/TangToc.png', 'Spell/LamCham.png', 'Spell/DungYen.png',
        'Spell/LuiVeSau.png', 'Spell/VeNha.png', 'Spell/VeDich.png'
    ])


Set1 = Head.button(800, 100, 'Play')
Set2 = Head.button(800, 200, 'Play')
Set3 = Head.button(800, 300, 'Play')
Set4 = Head.button(800, 400, 'Play')
Set5 = Head.button(800, 500, 'Play')
BG_choose = pygame.image.load('Option/BG.jpg')
Money_option1 = Head.button(120, 250, '100 $')
Money_option2 = Head.button(420, 250, '200 $')
Money_option3 = Head.button(720, 250, '400 $')


def ChooseYour(car1, car2, car3, car4,
               car5):  # Hàm chọn nhân vật mà mình cá cược
    YourSet = 0
    comment = font.render('CHOOSE YOUR CHARACTER', 1, (0, 0, 0))
    while YourSet == 0:
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('MONSTER RACING')
BG_menu = pygame.transform.scale(pygame.image.load('Menu/BG.jpg'),
                                 (screen_width, screen_height))
BG_option = pygame.transform.scale(pygame.image.load('Option/BG.jpg'),
                                   (screen_width, screen_height))
font = pygame.font.SysFont('Consolas', 30)

#define global variable
character = 0
length = 0
#bua img

#define button game
start = Head.button(430, 500, 'START')
play = Head.button(100, 300, 'PLAY')
store = Head.button(420, 300, 'STORE')
setting = Head.button(720, 300, 'SETTING')
exit = Head.button(720, 450, 'EXIT')
mini = Head.button(100, 450, 'mini game')
history = Head.button(420, 450, 'HISTORY')
back = Head.button(1, 1, 'BACK')
set1 = Head.button(20, 500, 'Set 1')
set2 = Head.button(210, 500, 'Set 2')
set3 = Head.button(410, 500, 'Set 3')
set4 = Head.button(610, 500, 'Set 4')
set5 = Head.button(820, 500, 'Set 5')
short_length = Head.button(120, 250, 'Short')
medium_length = Head.button(420, 250, 'Medium')
long_length = Head.button(720, 250, 'Long')