-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamestate.py
50 lines (41 loc) · 1.17 KB
/
gamestate.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
import collision_bullshit as Fuck
from ent import Ent
class Gamestate:
ents = []
scrsq = 768
hbound = 32
vbound = 32
score = 0
def spawnEnt(self, kind):
x = Ent(kind)
self.ents.append(x)
return x
def spawnPlayer(self):
ply = Ent("player")
ply.x = self.scrsq/2
ply.y = self.scrsq/2
self.ents.insert(0, ply)
def spawnCoin(self):
coin = self.spawnEnt("coin")
coin.x = self.scrsq/2
coin.y = (self.scrsq/2) + 128
def restartGame(self):
self.ents.clear()
self.spawnPlayer()
self.spawnCoin()
self.score = 0
def castCollisionChecks(self):
ents = self.ents
for i1 in range( len(ents) ):
e1 = ents[i1]
for i2 in range( i1+1, len(ents) ):
e2 = ents[i2]
if Fuck.checkEntCollide(e1, e2):
#print("TOUCHY")
e1.castCollDaemon(self, e2)
e2.castCollDaemon(self, e1)
#bruh
def castDaemons(self):
for ent in self.ents:
#ent.daemon(ent, self)
ent.castDaemon(self)