refactor: improve piece class readability

This commit is contained in:
Giovani Rodriguez
2021-06-11 15:15:15 -04:00
parent 328f149bd8
commit 4ea80c921b
2 changed files with 74 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
from typing import Tuple
from typing import List, Tuple
import pygame
from util.ConfigurationManager import ConfigurationManager
@@ -28,3 +28,11 @@ class Entity:
if square_one[i][0] == square_two[i][0] and square_one[i][1] == square_two[i][1]:
return True
return False
def collide_points(self, points: List) -> bool: # TODO change name later
for square_one in self.points:
for square_two in points:
for i in range(4): # 4 vertices
if square_one[i][0] == square_two[i][0] and square_one[i][1] == square_two[i][1]:
return True
return False