-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
80 lines (56 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
69
70
71
72
73
74
75
76
77
78
79
80
# pylint: disable=W0611
# Shut
import pygame, sys, os
pygame.init()
scrsize = width, height = 768, 768
msurf = pygame.display.set_mode(scrsize)
blackbg = 0, 0, 0
import images as img
img.hereWeGo()
import sfx as sfx
sfx.hereWeGo()
import bg
import collision_bullshit as Fuck
from gamestate import Gamestate
normfont = pygame.font.Font( pygame.font.get_default_font(), 50 )
pygame.display.set_caption("Apreta_R.txt: Bloc de notas")
bggrid = bg.BackgroundAnim()
target_delay = int(1000 / 60)
tickerEvent = pygame.event.custom_type()
pygame.time.set_timer(tickerEvent, target_delay)
state = Gamestate()
def tick():
pass
while 1:
castTick = False
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == tickerEvent: castTick = True
if castTick:
keys = pygame.key.get_pressed()
# predraw time (bg stuf)
msurf.fill(blackbg)
gridsurf = pygame.Surface([768,768])
#bgstr = "v-buck generator episode 5"
bgstr = "v-bucks: " + str(state.score)
gridsurf.blit( normfont.render(bgstr, True, (255,255,255)) , [0,0])
bggrid.okthanks(state.score)
bggrid.daemon(gridsurf)
gridsurf.set_alpha(128)
msurf.blit(gridsurf, [0,0])
# game time
if keys[pygame.K_r]:
state.restartGame()
sfx.playSong()
state.ents = [ent for ent in state.ents if ent.valid]
state.castDaemons()
state.castCollisionChecks()
# draw time
for ent in state.ents:
spr = img.get(ent.sprite)
if ent.dodraw and spr is not None:
#print("french")
pos = [ent.x, ent.y]
msurf.blit(spr, pos)
pygame.display.flip()
#pygame.time.delay( target_delay )