text: import pygame
  
  class projectile(object):
      def __init__(self,x,y,radius,color,facing):
          self.x = x
          self.y = y
          self.radius = radius
          self.color = color
          self.facing = facing
          self.vel = 8 * facing
  
      def draw(self,win):
          pygame.draw.circle(win, self.color, (self.x,self.y), self.radius)
  
  def control(man,shootLoop,bullets):
      keys = pygame.key.get_pressed()
  
      if keys[pygame.K_SPACE] and shootLoop == 0:
          if man.left:
              facing = -1
          else:
              facing = 1
  
          if len(bullets) < 5:
              bullets.append(projectile(round(man.x + man.width //2),
               round(man.y + man.height//2), 6, (0,0,0), facing))
  
          shootLoop = 1
  
      man.static = True
      man.attack = False
      man.left = False
      man.right = False
      man.standing = False
      if keys[pygame.K_SPACE]:
          man.attack = True
          man.left = False
          man.right = False
          man.standing = False
          man.static = False
  
      if keys[pygame.K_LEFT] and man.x > man.vel:
          man.x -= man.vel
          man.left = True
          man.right = False
          man.standing = False
          man.attack = False
          man.static = False
      elif keys[pygame.K_RIGHT] and man.x < 800 - man.width - man.vel:
          man.x += man.vel
          man.right = True
          man.left = False
          man.standing = False
          man.attack = False
          man.static = False
      else:
          man.standing = True
          man.walkCount = 0
  
      if not(man.isJump):
          if keys[pygame.K_UP]:
              man.isJump = True
              man.right = False
              man.left = False
              man.attack = False
              man.static = False
              man.walkCount = 0
      else:
          if man.jumpCount >= -10:
              neg = 1
              if man.jumpCount < 0:
                  neg = -1
              man.y -= (man.jumpCount ** 2) * 0.5 * neg
              man.jumpCount -= 1
          else:
              man.isJump = False
              man.jumpCount = 10
  