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:
parent
ff29e52a8d
commit
ef798b02e7
@ -1,5 +1,11 @@
|
||||
import src.entities.Entity as Entity
|
||||
from src.entities.Entity import 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
|
||||
|
@ -1,5 +1,6 @@
|
||||
class Entity:
|
||||
|
||||
def __init__(self):
|
||||
self.texture
|
||||
self.pos
|
||||
self.id
|
||||
self.texture = None
|
||||
self.pos = None
|
||||
self.id = None
|
||||
|
Loading…
Reference in New Issue
Block a user