feat(game): add figure offset

This commit is contained in:
Kristofers Solo 2024-01-04 02:04:49 +02:00
parent 29d83322af
commit b5e7a7b12f
2 changed files with 2 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class Block(pygame.sprite.Sprite):
self.image = pygame.Surface(CONFIG.game.cell)
self.image.fill(color)
self.pos = pygame.Vector2(pos)
self.pos = pygame.Vector2(pos) + CONFIG.game.offset
x = self.pos.x * CONFIG.game.cell.width
y = self.pos.y * CONFIG.game.cell.height
self.rect = self.image.get_rect(topleft=(x, y))

View File

@ -17,6 +17,7 @@ class Game:
cell: Size = Size(40, 40)
size: Size = Size(columns * cell.width, rows * cell.width)
pos: Vec2 = Vec2(padding, padding)
offset: Vec2 = Vec2(columns // 2, -1)
@define