I am trying to implement collisions with python, the collisions isn't the problem. I want to call a method inside another method using OOP, but it isn't recognised. Can you do this? How?
def collision_test(self,rect,tiles,x,y): #CREATING A RECT FOR THE GAME MAP(TILES)
hit_list = []
for tile in tiles:
if rect.colliderect(tile):
hit_list.append(tile)
return hit_list
def move(self,rect,x,y,tiles): #testing collisions
collision_types = {'top': False, 'bottom': False, 'right': False, 'left': False}
rect.x += x
hit_list = collision_test(self,rect,tiles)
for tile in hit_list:
if self.move_right == True:
rect.right = tile.left
Here collision_test isn't recognised.