I'm trying to make multiple platforms (blocks) on screen on which player can jump and land on it. When I just keep only one block, player jumps on it and land easily. But when I create other platform and player jumps, it gets hit by the block and goes below on the map. But if I try to jump over other platform, it lands on the surface easily.
What I tried so far,
I forgot to add these lines,
# Checking Collision of Platform and Hero self.obstacleHit_or_not(self.hero, self.platform, 460) self.obstacleHit_or_not(self.hero, self.platform1, 460) self.obstacleHit_or_not(self.hero, self.platform2, 460) # This function works for Blocks only def obstacleHit_or_not(self, hero, platform, position): hit = pygame.sprite.collide_rect(hero, platform) if hit: #print("ITS HITTING") hero.y = position print("hero.y - ", hero.y) elif hero.y == position: #print("HITTING INSIDE OF 450") while True: hero.y += 5 if hero.y >= 625: break