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

2015/2/27

How to make a bullet follow another actor but not turn towards it?

wsrenwick wsrenwick

2015/2/27

#
I'm trying to make a first person shooter kind of game but I need the enemies to shoot your hand somehow, I want the enemies to fire a bullet towards your hand but not turn towards it, so that you can move out of the way and doge the bullet. For a school project, need urgent reply. Thanks
danpost danpost

2015/2/27

#
Whether you are having the bullet follow the actor with or without turning toward it is done exactly the same way. The only difference is WHEN you turn toward the other actor. To follow turning towards the other actor, you would continuously, via the 'act' method', turn toward the other actor. To follow without turning towards the other actor, you would only once turn toward the other actor, via the 'addedToWorld' method or (and this next way is the one I prefer) in the class of the enemy after creating the bullet and adding it into the world.
You need to login to post a reply.