summaryrefslogtreecommitdiff
path: root/src/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper.py')
-rw-r--r--src/helper.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/helper.py b/src/helper.py
index 2f4e53e..c9a77db 100644
--- a/src/helper.py
+++ b/src/helper.py
@@ -45,12 +45,17 @@ def get_block_texture(block):
return blocks[block]['texture']
def draw_texture(id):
- if id < 10:
- pos = (42 * id, 0)
- else:
- pos = (42 * (id - (floor(((id + 1) / 10) - 1) * 10)), 42 * (floor(((id + 1) / 10) - 1)))
+ x = 0
+ y = 0
+
+ for i in range(id):
+ x += 42
+
+ if x >= 420:
+ x = 0
+ y += 42
- return texture_map.subsurface((pos[0], pos[1], 42, 42))
+ return texture_map.subsurface((x, y, 42, 42))
def draw_control(id):
if id < 10: