|
@@ -20,7 +20,7 @@ class Breakout:
|
20
|
20
|
self.timestep = ts
|
21
|
21
|
self.timeout = to
|
22
|
22
|
|
23
|
|
- self.paddle_width = 43#9
|
|
23
|
+ self.paddle_width = 9
|
24
|
24
|
|
25
|
25
|
self.winText = ScrollText(self.gui, "You Won!", "uushi",
|
26
|
26
|
2, 50, (0, 255, 0))
|
|
@@ -96,12 +96,12 @@ class Breakout:
|
96
|
96
|
|
97
|
97
|
return False
|
98
|
98
|
|
99
|
|
- def buttons(self):
|
|
99
|
+ def buttons(self, next_step=False):
|
100
|
100
|
keys = self.input.get()
|
101
|
101
|
|
102
|
|
- if keys["left"] and (not self.old_keys["left"]) and (not self.old_keys["select"]):
|
|
102
|
+ if keys["left"] and (not self.old_keys["left"] or next_step) and (not self.old_keys["select"]):
|
103
|
103
|
self.direction = "l"
|
104
|
|
- elif keys["right"] and (not self.old_keys["right"]) and (not self.old_keys["select"]):
|
|
104
|
+ elif keys["right"] and (not self.old_keys["right"] or next_step) and (not self.old_keys["select"]):
|
105
|
105
|
self.direction = "r"
|
106
|
106
|
elif (keys["select"] and keys["start"] and (not self.old_keys["start"])) or (keys["start"] and keys["select"] and (not self.old_keys["select"])):
|
107
|
107
|
self.restart()
|
|
@@ -171,9 +171,10 @@ class Breakout:
|
171
|
171
|
self.scoreText.draw()
|
172
|
172
|
|
173
|
173
|
def draw(self):
|
|
174
|
+ now = time.time()
|
174
|
175
|
# handle / generate player inputs
|
175
|
176
|
if self.input != None:
|
176
|
|
- self.buttons()
|
|
177
|
+ self.buttons((now - self.last) >= self.timestep)
|
177
|
178
|
else:
|
178
|
179
|
# TODO "AI"
|
179
|
180
|
pass
|