mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(game): add figure offset
This commit is contained in:
parent
29d83322af
commit
b5e7a7b12f
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user