Skip to content

Commit 5d6190b

Browse files
committed
keys 1 - 0, not 0 - 9
1 parent 1b39e03 commit 5d6190b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ def __init__(self, *args, **kwargs):
247247
self.dy = 0
248248
self.inventory = [BRICK, GRASS, SAND]
249249
self.block = self.inventory[0]
250-
self.num_keys = [key._0, key._1, key._2, key._3, key._4, key._5, key._6, key._7, key._8, key._9]
250+
self.num_keys = [
251+
key._1, key._2, key._3, key._4, key._5,
252+
key._6, key._7, key._8, key._9, key._0]
251253
self.model = Model()
252254
self.label = pyglet.text.Label('', font_name='Arial', font_size=18,
253255
x=10, y=self.height - 10, anchor_x='left', anchor_y='top',
@@ -380,7 +382,8 @@ def on_key_press(self, symbol, modifiers):
380382
elif symbol == key.TAB:
381383
self.flying = not self.flying
382384
elif symbol in self.num_keys:
383-
self.block = self.inventory[(symbol - self.num_keys[0]) % len(self.inventory)]
385+
index = (symbol - self.num_keys[0]) % len(self.inventory)
386+
self.block = self.inventory[index]
384387
def on_key_release(self, symbol, modifiers):
385388
if symbol == key.W:
386389
self.strafe[0] += 1

0 commit comments

Comments
 (0)