Hello,

I have recently started to develop my own game in Java and am just starting to get the hang of it. I've watched various tutorials on making an engine etc and have picked up quite a lot.

I am struggling with one problem though, I have a world and two entities (The player and a Rat). The player is controlled using the keyboard which was easy to setup. But, how can I randomly get the Rat to move in a random direction with random intervals all by itself?

I've tried a few different ways but I'm getting quite a few problems with it. I'm not looking for any specific source code since it will be different for mine anyway but I'm just looking for any logic/ideas if anyone has any.

Thanks!

In my code snippets, you will find one that plots a random walk.
It makes use of polar coordinates. I randomly generate an angle(direction) and a distance(to walk), which I then convert to cartesian coordinates, to be plotted.
It is in C#, if you like it i will post a link to it here or look it up yourself.

That sounds ok to me. If you could please post the link, thanks.