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

2016/10/28

AI must shoot towards my tank

brothermic brothermic

2016/10/28

#
hi, I wanna write a tankgame. But my enemy's must be able to shoot towards my tank when my tank gets close enough. I have no idea how to make them shoot their bullets or flametrowers etc towards me. I found somewhere it has something to do with vectors correct?
danpost danpost

2016/10/28

#
brothermic wrote...
I wanna write a tankgame. But my enemy's must be able to shoot towards my tank when my tank gets close enough. I have no idea how to make them shoot their bullets or flametrowers etc towards me. I found somewhere it has something to do with vectors correct?
Yes, it does have something to do with vectors; but, you do not have to deal with them directly. You can use the 'turnTowards' method of the Actor class to direct the "projectiles" toward your tank.
You need to login to post a reply.