-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
68 lines (43 loc) · 1.79 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
import pygame, sys, csv, os
from Settings import Settings
import Button
from pathlib import Path
from text_file_reader import read_from_file
from functions import create_static, load_stage, manage_text
def run_game():
###################################################################################
#initialize pygame and "static" elements
pygame.init()
setting = Settings()
screen = pygame.display.set_mode((setting.screen_width, setting.screen_height))
text_screen = pygame.Surface((590, 570))
text_screen.fill((230, 230, 230))
font = pygame.font.SysFont("comicsansms", 25)
normal_font = pygame.font.SysFont("calibri", 27)
current_stage = load_stage('test')
write_array = []
just_text = current_stage.arr
create_static(screen, setting)
map = pygame.Surface((250, 250))
done = False
buttons = current_stage.button_arr
########################################################################################
#main gameplay loop, redraw changable elements
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.MOUSEBUTTONDOWN:
print(pygame.mouse.get_pos())
for button in buttons:
if button.rect.collidepoint(pygame.mouse.get_pos()):
current_stage = load_stage(button.link)
just_text = current_stage.arr
buttons = current_stage.button_arr
screen.blit(map, (900, 50))
screen.blit(text_screen, (256,0))
for button in buttons:
button.render(screen, font)
manage_text(screen, just_text)
pygame.display.flip()
run_game()