From 5a50cd93de8cb94154777e2da8f1bbca86479199 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 3 Sep 2023 22:38:14 +0200 Subject: Updated 4 files and added 5 files (automated) --- src/helper.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/helper.py') 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: -- cgit