summaryrefslogtreecommitdiff
path: root/src/helper.py
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-08-31 21:00:30 +0200
committerRaindropsSys <contact@minteck.org>2023-08-31 21:00:30 +0200
commite54ac640f1d3f7071a48032e924b04529cbd358f (patch)
tree91efa742451921231e0695a5b5c99a1c4fac19f9 /src/helper.py
downloadblocks-e54ac640f1d3f7071a48032e924b04529cbd358f.tar.gz
blocks-e54ac640f1d3f7071a48032e924b04529cbd358f.tar.bz2
blocks-e54ac640f1d3f7071a48032e924b04529cbd358f.zip
Initial commit
Diffstat (limited to 'src/helper.py')
-rw-r--r--src/helper.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/helper.py b/src/helper.py
new file mode 100644
index 0000000..0504a58
--- /dev/null
+++ b/src/helper.py
@@ -0,0 +1,16 @@
+from blocks import blocks
+import pygame
+from math import floor
+
+texture_map = pygame.image.load('./assets/textures/texture_atlas.png')
+
+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)))
+
+ return texture_map.subsurface((pos[0], pos[1], 42, 42)) \ No newline at end of file