title: Pygame making an object chase the cursor
body: <p>Been at this for the past few hours, trying to make a small program where an image chases the cursor around. So far I've managed to make it so that the image is directly on top of the cursor and follows it around that way. However what I need is for the image to actually "chase" the cursor, so it would need to initially be away from it then run after it until it's then on top of the mouse.</p>
  
  <p>Basically hit a wall with whats going wrong and what to fix up, here's what I've gotten so far:</p>
  
  <pre><code>from __future__ import division
  import pygame
  import sys
  import math
  from pygame.locals import *
  
  
  class Cat(object):
      def __init__(self):
          self.image = pygame.image.load('ball.png')
          self.x = 1
          self.y = 1
  
      def draw(self, surface):
          mosx = 0
          mosy = 0
          x,y = pygame.mouse.get_pos()
          mosx = (x - self.x)
          mosy = (y - self.y)
          self.x = 0.9*self.x + mosx
          self.y = 0.9*self.y + mosy
          surface.blit(self.image, (self.x, self.y))
          pygame.display.update()
  
  
  pygame.init()
  screen = pygame.display.set_mode((800,600))
  cat = Cat()
  Clock = pygame.time.Clock()
  
  running = True
  while running:
      screen.fill((255,255,255))
      cat.draw(screen)
  
      for event in pygame.event.get():
          if event.type == QUIT:
              pygame.quit()
              sys.exit()
  
      pygame.display.update()
      Clock.tick(40)
  </code></pre>
  
  <p>Probably not in the best shape of coding, been messing with this for just over 5 hours now. Any help is much appreciated! Thanks :)</p>