title: Why isn't my image drawing correctly in my platformer?
body: <p>I've been following a tutorial online just to get a simple 2D platformer working and I can't understand why it can't get the boxes to draw? Also the poorly drawn stick figure is being drawn in 2 parts that are then broken</p>
  <p>I've tried messing with the values for 'stickman.png', 'woodenboxbutsmaller.png' and window sizes but I just can't get it do it correctly? I think it's trying to draw the stick figure as boxes for some reason which is why it would be appearing all broken up, but it should be trying to use the 'woodenbox png'</p>
  <pre class="lang-py prettyprint-override"><code>import random
  import pygame
  import time
  pygame.init()
  
  display_width = 800   # game window width and height
  display_height = 600
  
  background = (255,255,255)
  bg = pygame.image.load('smb.png')
  
  black = (0,0,0)   # some colours for buttons and stuff
  white = (255,255,255)
  red = (200,0,0)
  green = (0,200,0)
  bright_red = (255,0,0)
  bright_green = (0,255,0)
  
  object_width = 50 # width hitbox of the object
   
  gameDisplay = pygame.display.set_mode((display_width,display_height))
  pygame.display.set_caption('the greatest 2d platformer of all time: the game')
  clock = pygame.time.Clock()
  
  def button(msg,x,y,w,h,ic,ac,action=None):   # button function allows menu to work later
      mouse = pygame.mouse.get_pos()
      click = pygame.mouse.get_pressed()
      print(click)
      if x+w &gt; mouse[0] &gt; x and y+h &gt; mouse[1] &gt; y:
          pygame.draw.rect(gameDisplay, ac,(x,y,w,h))
  
          if click[0] == 1 and action != None:
              action()         
      else:
          pygame.draw.rect(gameDisplay, ic,(x,y,w,h))
  
      smallText = pygame.font.SysFont(&quot;comicsansms&quot;,20)
      textSurf, textRect = text_objects(msg, smallText)
      textRect.center = ( (x+(w/2)), (y+(h/2)) )
      gameDisplay.blit(textSurf, textRect)
    
  def message_display(text):   # message function that makes messages appear after various actions (usually crashing)
      largeText = pygame.font.Font('freesansbold.ttf',100)
      TextSurf, TextRect = text_objects(text, largeText)
      TextRect.center = ((display_width/2),(display_height/2))
      gameDisplay.blit(TextSurf, TextRect)
      pygame.display.update()
      time.sleep(2)
      game_loop()
  
  def text_objects(text, font):   # some text thing? think it just allows messages to work
      textSurface = font.render(text, True, black)
      return textSurface, textSurface.get_rect()
  
  def things(thingx, thingy, thingw, thingh, color):   # i think this is for the floating squares?
      pygame.draw.rect(gameDisplay, color, [thingx, thingy, thingw, thingh])
  
  def game_intro():    # basically the main menu
  
      intro = True
  
      while intro:
          for event in pygame.event.get():
              #print(event)
              if event.type == pygame.QUIT:
                  pygame.quit()
                  quit()
  
          # sets white background and adds the text and buttons for the main menu
          gameDisplay.fill(white)
          largeText = pygame.font.SysFont(&quot;comicsansms&quot;,25)
          TextSurf, TextRect = text_objects(&quot;the greatest 2d platformer of all time: the game&quot;, largeText)
          TextRect.center = ((display_width/2),(display_height/2))
          gameDisplay.blit(TextSurf, TextRect)
  
          button(&quot;start&quot;,150,450,100,50,green,bright_green, game_loop)
          button(&quot;:(&quot;,550,450,100,50,red,bright_red,pygame.quit)
  
          pygame.display.update()
          clock.tick(15)
  
  class Sprite(pygame.sprite.Sprite):
      def __init__(self, image, startx, starty):
          super().__init__()
  
          self.image = pygame.image.load('stickman.png')
          self.rect = self.image.get_rect()
  
          self.rect.center = [startx, starty]
  
      def update(self):
          pass
      def draw(self, screen):
          screen.blit(self.image, self.rect)
  
  class Player(Sprite):
      def __init__(self, startx, starty):
          super().__init__(&quot;stickman.png&quot;, startx, starty)
  
  class Box(Sprite):
      def __init__(self, startx, starty):
          super().__init__(&quot;woodenboxbutsmaller.png&quot;, startx, starty)
  
  def game_loop():
      pygame.init()
      gameDisplay = pygame.display.set_mode((display_width,display_height))
      clock = pygame.time.Clock()
  
      player = Player(200,400)
      
      boxes = pygame.sprite.Group()
      for bx in range(0,800,1400):
          boxes.add(Box(bx,600))
  
      while True:
          pygame.event.pump()
          player.update()
  
          #draw loop
          gameDisplay.fill(background)
          player.draw(gameDisplay)
          boxes.draw(gameDisplay)
          pygame.display.flip()
  
          clock.tick(60) # 60fps frame rate
  
  game_intro()
  </code></pre>
  <p>I'm not very adept at programming and I just need this to work for a school project</p>