Не обращайте внимания на то, насколько это тормозит, я сделал это очень быстро
Демо-версия Dino Side-Scroller
Я подозреваю, что ошибка возникает именно в этом методе:
Код: Выделить всё
def Check_Collision(self, player):
player_on_platform = False
BUFFER = 5 # Small buffer to prevent micro-bouncing
for platform_rect in self.platforms:
# Check if the player is falling and is within the range to land on the platform
if (
player.velocity_y > 0 and
player.rect.bottom + player.velocity_y >= platform_rect.top - BUFFER and
player.rect.bottom
Подробнее здесь: [url]https://stackoverflow.com/questions/79178689/how-to-fix-an-issue-with-platform-collision-in-pygame[/url]
Мобильная версия