Sztuczna_Inteligencja/gridElement.py

17 lines
675 B
Python
Raw Permalink Normal View History

2019-04-10 10:31:09 +02:00
import pygame
2019-04-16 13:28:11 +02:00
from pygame.math import Vector2
2019-04-10 10:31:09 +02:00
class GridElement(object):
def __init__(self, x, y, game):
self.game = game
2019-04-16 13:28:11 +02:00
self.position = Vector2()
self.position.x = x
self.position.y = y
2019-04-10 10:31:09 +02:00
game.idItem += 1
self.number = game.idItem
#Cała matematyka skalowania odbywa się tutaj
2019-04-10 10:31:09 +02:00
def draw(self):
2019-04-16 13:28:11 +02:00
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))