forked from InfoProjekt/game
Development #1
3 changed files with 32 additions and 20 deletions
BIN
art/images/start.png
Normal file
BIN
art/images/start.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 MiB |
26
classes.py
26
classes.py
|
|
@ -137,10 +137,24 @@ class DropDown():
|
|||
return -1
|
||||
|
||||
|
||||
class Scene():
|
||||
def __init__(self, _type, bg, objects) -> None:
|
||||
self.name
|
||||
class GameObjects():
|
||||
def __init__(self, name:str, _type:str, bg, objects:list) -> None:
|
||||
self.name = name
|
||||
self.type = _type
|
||||
if self.type != 'cutscene':
|
||||
self.background = bg
|
||||
self.objects = objects
|
||||
self.background = bg
|
||||
self.objects = objects
|
||||
|
||||
|
||||
class Scene(GameObjects):
|
||||
def __init__(self, name:str, _type:str, bg, objects:list) -> None:
|
||||
super().__init__(name, _type, bg, objects)
|
||||
|
||||
|
||||
class Room(GameObjects):
|
||||
def __init__(self, name:str, _type:str, bg, objects:list, exits:list) -> None:
|
||||
super().__init__(name, _type, bg, objects)
|
||||
self.exits = exits
|
||||
if self.type == 'normal' or self.type == 'boss':
|
||||
self.locked = True
|
||||
else:
|
||||
self.locked = False
|
||||
|
|
|
|||
24
main.py
24
main.py
|
|
@ -24,10 +24,7 @@ def readConfig():
|
|||
def quitGame():
|
||||
#save progress somehow, if needed
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
||||
def uwu():
|
||||
print('uwu')
|
||||
quit()
|
||||
|
||||
def play(screen, clock, running, background, isblack, WIDTH, HEIGHT):
|
||||
objects = []
|
||||
|
|
@ -92,15 +89,16 @@ def options(screen, clock, running, background, isblack, WIDTH, HEIGHT):
|
|||
|
||||
def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
|
||||
objects = []
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Play", play))
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu))
|
||||
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu))
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
quitGame()
|
||||
# RENDER YOUR GAME HERE
|
||||
with open(background, 'r') as i:
|
||||
with open(f'art/images/{background}', 'r') as i:
|
||||
bg = pygame.image.load(i)
|
||||
bg = pygame.transform.scale(bg, (WIDTH, HEIGHT))
|
||||
# fill the screen with an image to clear the screen
|
||||
|
|
@ -117,11 +115,11 @@ def main():
|
|||
config = readConfig()
|
||||
screen, clock, running, isblack, background, objects = setUp(config["screen"])
|
||||
WIDTH, HEIGHT = screen.get_size()
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu))
|
||||
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play))
|
||||
|
||||
while running:
|
||||
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play))
|
||||
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu))
|
||||
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
|
||||
menu(screen, clock, running, background, isblack, WIDTH, HEIGHT)
|
||||
"""while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
|
|
@ -141,7 +139,7 @@ def main():
|
|||
# flip() the display to put your work on screen
|
||||
pygame.display.flip()
|
||||
|
||||
clock.tick(60) # limits FPS to 60
|
||||
clock.tick(60) # limits FPS to 60"""
|
||||
|
||||
pygame.quit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue