pygame sprite wall collision

后端 未结 3 1838
北恋
北恋 2020-11-28 16:13

I am working on a platform game in python and pygame. The entire code can be found at \"https://github.com/C-Kimber/FBLA_Game\". The issue I am having is with the collision

3条回答
  •  一生所求
    2020-11-28 16:38

    elif self.rect.top <= block.rect.bottom and self.rect.top >= block.rect.bottom - 15:  # Moving up; Hit the bottom side of the wall
            self.rect.top = block.rect.bottom
            self.yvel = 0
    

    Shouldn't yvel be set to a positive number to make it go up?

提交回复
热议问题