This repository has been archived by the owner on Aug 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
97 lines (66 loc) · 2.53 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
88
89
90
91
92
93
94
95
96
97
__author__ = 'luisl_000'
from main_room import PlatformWorld
from maze import Maze
from fibpuzzle import FibWorld
from engine import Engine
import pygame
from pygame import QUIT
class Game(object):
def __init__(self):
self.engine = None
self.main_room = None
self.maze_room = None
self.fib_room = None
def start(self):
self.engine = Engine(1200, 700)
self.engine.game = self
screen = pygame.display.set_mode((1200, 700), pygame.HWSURFACE, 32)
title_screen = pygame.image.load("assets/images/gui/title_screen.png").convert()
x = 1200/2 - title_screen.get_width()/2
y = 700/2 - title_screen.get_height()/2
# show title screen
exit_title_screen = False
while not exit_title_screen:
for event in pygame.event.get():
if event.type == QUIT:
Engine.clean_up()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
exit_title_screen = True
screen.fill((0, 0, 0))
screen.blit(title_screen, (x, y))
pygame.display.update()
self.main_room = PlatformWorld()
self.maze_room = Maze()
self.fib_room = FibWorld()
self.engine.worlds.append(self.main_room)
self.engine.worlds.append(self.maze_room)
self.engine.worlds.append(self.fib_room)
self.engine.set_world(self.main_room)
self.engine.run()
def go_to_maze(self):
self.engine.set_world(self.maze_room)
def go_to_fib(self):
self.engine.set_world(self.fib_room)
def go_to_main(self):
self.engine.set_world(self.main_room)
def go_to_end(self):
screen = pygame.display.set_mode((1200, 700), pygame.HWSURFACE, 32)
title_screen = pygame.image.load("assets/images/gui/end_screen.png").convert()
x = 1200/2 - title_screen.get_width()/2
y = 700/2 - title_screen.get_height()/2
# show title screen
exit_title_screen = False
while not exit_title_screen:
for event in pygame.event.get():
if event.type == QUIT:
Engine.clean_up()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
exit_title_screen = True
screen.fill((0, 0, 0))
screen.blit(title_screen, (x, y))
pygame.display.update()
self.start()
luminescence = Game()
luminescence.start()