Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def update(self):
self.image = pygame.transform.flip(self.image, True, False)
'''Help me brother i'm stuck!'''
if self.cl[0] and self.cl[1] and self.cl[2] and self.cl[3]:
if self.left:
c = 24
else:
c = -24
c = 24 if self.left else -24
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Player.update refactored with the following changes:

self.rect.x += c
for obj in helpers:
obj.rect.x += c
Expand All @@ -70,11 +67,10 @@ def update(self):
elif self.speed_x < 0:
self.speed_x += 1
'''Свободное падение'''
if not self.cl[2]:
if self.speed_y < 20:
self.speed_y += 1
else:
if self.cl[2]:
self.speed_y = 0
elif self.speed_y < 20:
self.speed_y += 1
if pygame.key.get_pressed()[pygame.K_UP] and (not self.cl[3] and not self.cl[1] and self.cl[2]):
self.speed_y = -20
if self.cl[2] and (self.cl[1] or self.cl[3]):
Expand Down