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

2015/3/11

How can I let enemies shot in my direction?

moraisai moraisai

2015/3/11

#
Hello I need help for my greenfoot porject. My enemies are shooting but how can I let them shot into my direction?
danpost danpost

2015/3/11

#
What have you tried, code-wise?
moraisai moraisai

2015/3/11

#
this is my shooting function: public void schuss() { if(Greenfoot.getRandomNumber(500) < 5) { bullet2 bullet2 = new bullet2(); getWorld().addObject(bullet2, getX(), getY()); bullet2.setRotation(getRotation()); } }
danpost danpost

2015/3/11

#
You need to have your enemies 'turnTowards' your location (face toward you) before shooting.
moraisai moraisai

2015/3/11

#
It works! Thank you
You need to login to post a reply.