summaryrefslogtreecommitdiff
path: root/src/helper.py
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-09-03 22:38:14 +0200
committerRaindropsSys <contact@minteck.org>2023-09-03 22:38:14 +0200
commit5a50cd93de8cb94154777e2da8f1bbca86479199 (patch)
tree74c427061e5f23bc709b8c976b1bf559666cc04e /src/helper.py
parent153d21ace9801ac665e2d7f99c967147d1214f29 (diff)
downloadblocks-5a50cd93de8cb94154777e2da8f1bbca86479199.tar.gz
blocks-5a50cd93de8cb94154777e2da8f1bbca86479199.tar.bz2
blocks-5a50cd93de8cb94154777e2da8f1bbca86479199.zip
Updated 4 files and added 5 files (automated)
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: