Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

player to walk on the surface

def gravity_check(self):
      hits = pygame.sprite.spritecollide(player ,ground_group, False)
      if self.vel.y > 0:
          if hits:
              lowest = hits[0]
              if self.pos.y < lowest.rect.bottom:
                  self.pos.y = lowest.rect.top + 1
                  self.vel.y = 0
                  self.jumping = False
Source by coderslegacy.com #
 
PREVIOUS NEXT
Tagged: #player #walk #surface
ADD COMMENT
Topic
Name
1+3 =