# Getting one sprite to "chase" another

**URL:** <https://forum.kirupa.com/t/getting-one-sprite-to-chase-another/295047>\
**Category:** Uncategorized\
**Created:** [August 24, 2009, 6:49pm UTC](https://forum.kirupa.com/t/getting-one-sprite-to-chase-another/295047 "2009-08-24T18:49:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![screeg](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@screeg](https://forum.kirupa.com/u/screeg)\
**Post date:** [August 24, 2009, 6:49pm UTC](https://forum.kirupa.com/t/getting-one-sprite-to-chase-another/295047/1 "2009-08-24T18:49:55Z")

</div>

I have ghost sprites in a haunted house which roam at random. If the player comes within a certain distance, they pursue him. Right now the ghosts jump in the direction of their target in 15 pixel increments based on the difference between ghost.x/y & pc.x/y.

Is there an elegant way to have the ghost sprite drift towards player’s sprite?
