title: Increase the size of an image during a collision with pygame?
body: <p>I have a program with a player (who is an image) and a rectangle and I want that when the player has a collision with the rectangle, the size of the image increase.</p>
  
  <hr>
  
  <p>For now, I have this code :</p>
  
  <pre><code>import pygame
  from random import randint
  
  WIDTH, HEIGHT = 800, 800
  FPS = 60
  
  pygame.init()
  
  win = pygame.display.set_mode((WIDTH, HEIGHT))
  fenetre_rect = pygame.Rect(0, 0, WIDTH, HEIGHT)
  pygame.display.set_caption("Hagar.io")
  clock = pygame.time.Clock()
  
  bg = pygame.image.load("bg.png").convert()
  bg_surface = bg.get_rect(center=(WIDTH / 2, HEIGHT / 2))
  bg_x = bg_surface.x
  bg_y = bg_surface.y
  x_max = WIDTH / 2
  y_max = HEIGHT / 2
  
  # player
  player = pygame.transform.scale(pygame.image.load("player.png").convert_alpha(), (i, i))
  player_rect = player.get_rect(center=(x_max, y_max))
  
  # cell
  rect_surface = pygame.Rect(300, 500, 20, 20)
  
  # Game loop
  running = True
  while running:
      dt = clock.tick(FPS) / 1000
  
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              running = False
  
      if player_rect.colliderect(rect_surface):
          print("collide")
  
      bg_surface.x = bg_x
      bg_surface.y = bg_y
  
      # draw on screen
      win.blit(bg, bg_surface)
      pygame.draw.rect(win, (255, 0, 0), rect_surface)
      win.blit(player, player_rect)
      pygame.display.flip()
  
  pygame.quit()
  </code></pre>
  
  <p>I have try to add in the "colliderect" condition but it does not work :</p>
  
  <pre><code>player_rect.width += 1
  player_rect.height += 1
  </code></pre>
  
  <hr>
  
  <p>Thanks for your help !</p>