-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
87 lines (64 loc) · 2.64 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import pygame
from tkinter import *
from tkinter import messagebox
import infoChicken
from infoChicken import ally_hp, ene_hp, currentally_hp, currentenemy_hp
import roosterfile
class Game:
def __init__(self):
self.balance = 1000
self.run = False
self.clock = pygame.time.Clock()
self.fps = 60
self.side_panel = 400
self.screen_width = 720
self.screen_height = 720
self.screen = None
self.background_img = None
def start_game(self):
pygame.init()
self.run = True
self.gui.destroy()
self.screen = pygame.display.set_mode((self.screen_width, self.screen_height))
pygame.display.set_caption("Battle")
font = pygame.font.Font('freesansbold.ttf', 32)
white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
text = font.render('GeeksForGeeks', True, green, blue)
textRect = text.get_rect()
textRect.center = (200,200)
self.background_img = pygame.image.load("background.jpg").convert_alpha()
self.game_loop()
def draw_bg(self):
self.screen.blit(self.background_img, (0, 0))
def game_loop(self):
while self.run:
self.clock.tick(self.fps)
self.draw_bg()
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.run = False
pygame.display.update()
pygame.quit()
def add_funds(self):
pass
def run_gui(self):
self.gui = Tk()
self.gui.configure(background="#003b00")
self.gui.title("Main Menu")
self.gui.geometry("720x720")
Balance = Label(self.gui, text=f"Balance: ${self.balance}", font=("Arial", 14), bg="#003b00", fg="#00ff41")
Title = Label(self.gui, text="Cock Fight", bg="#003b00", fg="#00ff41", font=("Arial", 35, "bold"))
StartButton = Button(self.gui, text="Start", command=self.start_game, bg="#003b00", fg="#00ff41", font=("Arial", 20, "bold"))
fundsButton = Button(self.gui, text="Add Funds", command=self.add_funds, bg="#003b00", fg="#00ff41", font=("Arial", 20, "bold"))
fundsLabel = Label(self.gui, text="Add Funds", bg="#003b00", fg="#00ff41", font=("Arial", 35, "bold"))
Balance.pack(side=TOP, anchor=NW, padx=10)
Title.pack()
StartButton.pack(pady=(0, 10))
fundsLabel.pack()
fundsButton.pack(pady=(0, 10))
self.gui.mainloop()
if __name__ == "__main__":
game = Game()
game.run_gui()