17 lines
675 B
Python
17 lines
675 B
Python
import pygame
|
|
from pygame.math import Vector2
|
|
|
|
|
|
class GridElement(object):
|
|
def __init__(self, x, y, game):
|
|
self.game = game
|
|
self.position = Vector2()
|
|
self.position.x = x
|
|
self.position.y = y
|
|
game.idItem += 1
|
|
self.number = game.idItem
|
|
|
|
#Cała matematyka skalowania odbywa się tutaj
|
|
def draw(self):
|
|
self.rect = pygame.Rect(self.position.x * self.game.gridElementWidth, self.position.y * self.game.gridElementHeight, self.game.gridElementWidth, self.game.gridElementHeight)
|
|
self.game.screen.blit(self.image, (self.position.x * self.game.gridElementWidth, self.position.y * self.game.gridElementHeight)) |