upgraded movement system to slide against walls
This commit is contained in:
parent
093e054aaf
commit
ced50f53d4
4
game.py
4
game.py
@ -166,6 +166,10 @@ class Player:
|
||||
if(game.test_collision(pygame.Rect(new_x-50, new_y-50, 100, 100), game.collisions) == False):
|
||||
self.x = new_x
|
||||
self.y = new_y
|
||||
elif(game.test_collision(pygame.Rect(self.x-50, new_y-50, 100, 100), game.collisions) == False):
|
||||
self.y = new_y
|
||||
elif(game.test_collision(pygame.Rect(new_x-50, self.y-50, 100, 100), game.collisions) == False):
|
||||
self.x = new_x
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user