zmiana tła na bramkach
This commit is contained in:
parent
539a08af0d
commit
404e8783cb
@ -20,16 +20,22 @@ class Enclosure:
|
|||||||
gate_x-=1
|
gate_x-=1
|
||||||
gate_y-=1
|
gate_y-=1
|
||||||
rect = pygame.Rect(gate_x * grid_size, gate_y * grid_size, grid_size, grid_size)
|
rect = pygame.Rect(gate_x * grid_size, gate_y * grid_size, grid_size, grid_size)
|
||||||
pygame.draw.rect(screen, (0, 0, 0), rect) # Fill the area with
|
|
||||||
screen.blit(self.imageGate, (gate_x * grid_size, gate_y * grid_size))
|
screen.blit(self.imageGate, (gate_x * grid_size, gate_y * grid_size))
|
||||||
|
|
||||||
def draw(self,screen, grid_size):
|
def draw(self,screen, grid_size):
|
||||||
self.imageH = pygame.transform.scale(self.imageH, (grid_size, grid_size))
|
self.imageH = pygame.transform.scale(self.imageH, (grid_size, grid_size))
|
||||||
self.imageV = pygame.transform.scale(self.imageV, (grid_size, grid_size))
|
self.imageV = pygame.transform.scale(self.imageV, (grid_size, grid_size))
|
||||||
|
gate_x, gate_y = self.gate
|
||||||
|
gate_x-=1
|
||||||
|
gate_y-=1
|
||||||
if self.x1 < self.x2:
|
if self.x1 < self.x2:
|
||||||
for i in range(self.x1, self.x2+1):
|
for i in range(self.x1, self.x2+1):
|
||||||
|
if (i, self.y1) != (gate_x, gate_y):
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y1 * grid_size))
|
screen.blit(self.imageH, (i * grid_size, self.y1 * grid_size))
|
||||||
|
if (i, self.y2) != (gate_x, gate_y):
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y2 * grid_size))
|
screen.blit(self.imageH, (i * grid_size, self.y2 * grid_size))
|
||||||
for j in range(self.y1, self.y2+1):
|
for j in range(self.y1, self.y2+1):
|
||||||
|
if (self.x1, j) != (gate_x, gate_y):
|
||||||
screen.blit(self.imageV, (self.x1 * grid_size, j * grid_size))
|
screen.blit(self.imageV, (self.x1 * grid_size, j * grid_size))
|
||||||
|
if (self.x2, j) != (gate_x, gate_y):
|
||||||
screen.blit(self.imageV, (self.x2 * grid_size, j * grid_size))
|
screen.blit(self.imageV, (self.x2 * grid_size, j * grid_size))
|
Loading…
Reference in New Issue
Block a user