blob: 669ea1b21fe123e11c392d1cb5af3bb1cbfea15c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from blocks import blocks
import pygame
from math import floor
texture_map = pygame.image.load('./assets/textures/texture_atlas.png')
def text(text, size, color):
return pygame.font.Font("./assets/font/main.ttf", size).render(text, False, color)
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))
|