Pygame - 与平台碰撞

时间:2021-04-17 08:11:20

标签: python pygame

if player.hitbox[1] < platform_img.hitbox[1] + platform_img.hitbox[3] and player.hitbox[1] + player.hitbox[3] > platform_img.hitbox[1]:
    if player.hitbox[0] + player.hitbox[2] > platform_img.hitbox[0] and player.hitbox[0] < platform_img.hitbox[0] + platform_img.hitbox[2]:
        player.collision()

这是我使用碰撞箱检测玩家和平台之间碰撞的代码。目前,角色可以跳到平台上,但是当他们下来时,他们会跳到屏幕下方。如果我跳到平台下,那么角色的头部就会卡在平台中并且他们不会向下移动。我该如何解决这个问题?

0 个答案:

没有答案