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

2016/6/5

Turning Towards the Mouse

sengst sengst

2016/6/5

#
I want to have a way to have an actor turn towards the mouse, however i would like to have it rotate slowly. I can not find a way to have the actor know when to stop rotating (it is pointing towards the mouse cursor). Does anyone know how to make this work? Thank you.
danpost danpost

2016/6/5

#
Maybe you could take a look at my Zombie Shooter Demo scenario, which has the zombies slowly turning toward the actor when in range.
sengst sengst

2016/6/7

#
I looked at your scenario, and had some fun playing it as well. However I was unable to find the code which had the "zombies" turn to the player slowly. Would you mind sending the code to do that? I am trying to have a tank turret turn slowly to where the mouse is pointing. Thank you!
danpost danpost

2016/6/7

#
It appears I did not assign the different text files to the different buttons. I will do that. However, the one class that any button will show is the one that has the turning of the enemies. It is the first part of the act method up until the 'else' line. You can view that code while running the scenario, but you must be logged onto the site to do so; or you can download the scenario and open it up in your greenfoot application.
sengst sengst

2016/6/7

#
Thank you for all of your help! It seems that i have found my own way of solving the problem, though probably a round-about way of doing so. Once again thank you for you continuous help.
You need to login to post a reply.