This site requires JavaScript, please enable it in your browser!
Greenfoot back
swapon
swapon wrote ...

2012/12/17

Calculate angle to destination

swapon swapon

2012/12/17

#
Hello, I'm programming a little game in Greenfoot and would like my enemies to hunt my Hero. To get this done, I'd like to write a little function that calculates the rotation the enemy has to be set to in order to reach exactly my position. And here's the problem; I have absolutely no idea how to do that. Can anybody help me?
Zamoht Zamoht

2012/12/17

#
Use this method in your enemy actor. turnTowards(int x, int y) Turn this actor to face towards a certain location. You are going to make sure your enemies know where your hero is.
swapon swapon

2012/12/18

#
Great, that's exactly what I was looking for! Thank you very much.
You need to login to post a reply.