[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Moving a sprite along a map.



Hello All

I'm relatively new to python and pygame. I'm making a sort of tower defense game, involving llamas and stuff. I have managed to generate a map, that can have its layout (a bunch of lines on a .png) read from a text file, and that creates a 'path' where the 'creeps' are supposed to run along.

My problem is, how do I program a 'creep' to run along a specific path on my map? What I would ideally like is for the 'creeps' to 'know' where to go, in other words they would always run in one direction along a winding path and this path can be randomly generated.

Can anybody suggest an algorithm or point me to a relevant example where I can have this answered please?

Thanks for any help :)

Nicolaas

--

 ~)
  (_---;        The Llama compels me...
   /|~|\
  / / / |