Tuesday, April 1, 2008

How To Make A Sprite Chase Another Sprite

In this tutorial I am going to show you how to make a sprite chase after another sprite.

Lets Begin:

Step 1:

Choose your sprites.


Step 2:

Get the sprite that will be chased moving and bouncing off the edge in a random direction.


Step 3:

Now get the second sprite following the first and moving towards it slowly.

If you want to you can make it so that when the sprites touch they say things to one another, but this is only an optional option. To do this use the following code:

1 comment:

Unknown said...

nice extension to the project >> bonus