Added method to collidable to check if a collision occurred. Added = None to each attribute in Entity to stop errors from showing

This commit is contained in:
jonspacz 2020-04-02 13:38:14 +02:00
parent ff29e52a8d
commit ef798b02e7
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,11 @@
import src.entities.Entity as Entity from src.entities.Entity import Entity
class Collidable(Entity): class Collidable(Entity):
pass
def check_for_collision(self, x_pos, y_pos):
if self.pos[0] == x_pos:
if self.pos[1] == y_pos:
return True
return False

View File

@ -1,5 +1,6 @@
class Entity: class Entity:
def __init__(self): def __init__(self):
self.texture self.texture = None
self.pos self.pos = None
self.id self.id = None