Skip to content

Commit 6d78683

Browse files
committed
Nice font
1 parent 82cdb1e commit 6d78683

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

__init__.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,30 @@ def redrawAll(canvas, data):
5353
data.star1.draw(canvas)
5454
data.shield1.draw(canvas)
5555
data.star1.draw(canvas)
56-
57-
canvas.create_text(data.width/2, data.height/2,
58-
text="Timer Calls: " + str(data.timerCalls)+" " + str(data.rotation), fill = 'white')
5956
defender.redrawAll(canvas, data)
6057
#data.shield.draw(canvas)
6158
if data.mode == 'end':
6259
drawEnd(canvas)
6360

6461
def timerFired(data):
65-
handFinder.timerFired(data)
66-
frame = data.frame
67-
if data.pause != True:
68-
data.rotation = math.degrees(frame.hands[0].palm_normal.roll)
62+
if data.mode == 'play':
63+
handFinder.timerFired(data)
64+
frame = data.frame
65+
if data.pause != True:
66+
data.rotation = math.degrees(frame.hands[0].palm_normal.roll)
67+
68+
data.shield1.startPosL = tuple(map(lambda x: x+data.rotation, data.shields))
69+
#print data.shields
70+
#data.rectOffsetX = frame.hands[0].palm_position[0]
71+
#data.rectOffsetY = frame.hands[0].palm_position[2]
72+
#data.rectOffset = frame.hands[0].palmPosition
73+
data.timerCalls += 1
74+
defender.timerFired(data)
75+
if data.star1.die() == True:
76+
data.mode = 'end'
6977

70-
data.shield1.startPosL = tuple(map(lambda x: x+data.rotation, data.shields))
71-
#print data.shields
72-
#data.rectOffsetX = frame.hands[0].palm_position[0]
73-
#data.rectOffsetY = frame.hands[0].palm_position[2]
74-
#data.rectOffset = frame.hands[0].palmPosition
75-
data.timerCalls += 1
76-
defender.timerFired(data)
78+
79+
7780

7881

7982

bullet.pyc

-414 Bytes
Binary file not shown.

collision.pyc

-184 Bytes
Binary file not shown.

defender.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def timerFired(data):
4141
if data.timer % 100 == 0:
4242
data.seconds += 1
4343

44-
if data.timer % 1000 == 0:
44+
if data.timer % 500 == 0:
4545
data.level += 1
4646

4747
if data.timer % int(100 * (4./5)**data.level) == 0:
@@ -107,6 +107,7 @@ def timerFired(data):
107107

108108
data.collisions.append(Collision(pcollision[0],pcollision[1], 2, bullet.r))
109109
data.bullets.remove(bullet)
110+
data.star1.hit()
110111

111112

112113
for collision in data.collisions:
@@ -127,13 +128,12 @@ def redrawAll(canvas, data):
127128
collision.draw(canvas)
128129
data.collisions.remove(collision)
129130

130-
canvas.create_oval(x - 10, y - 10, x+10,y+10, fill = "blue")
131131

132132

133133
for bullet in data.bullets:
134134
bullet.draw(canvas)
135135

136-
canvas.create_text(0,0, anchor = NW, text = "Time: %d" % data.seconds)
137-
canvas.create_text(data.width,0, anchor = NE, text = "Level: %d" % data.level)
136+
canvas.create_text(0,0, anchor = NW, text = "Health: %d" % data.star1.health, font = "Arial 14")
137+
canvas.create_text(data.width,0, anchor = NE, text = "Level: %d" % data.level, font = 'Arial 14')
138138

139139

defender.pyc

-2 Bytes
Binary file not shown.

handFinder.pyc

0 Bytes
Binary file not shown.

starclass.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def hit(self):
3838
self.color = 'red'
3939

4040
def die(self):
41-
print('called')
4241
if self.health <= 0:
4342
self.color = 'black'
4443
return True

starclass.pyc

-18 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)