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

2018/2/1

Distance Comparisons

SuperNinja SuperNinja

2018/2/1

#
So in the game that I published, the boss character has a dart that followed around the player until it reached a certain getX(). I am now working on adding a second player, and I can't seem to get it tracking both actors at the same time. Is there a way I can compare distance so I can give the dart a target based of that instead of only targeting one actor or the other?
danpost danpost

2018/2/1

#
SuperNinja wrote...
Is there a way I can compare distance so I can give the dart a target based of that instead of only targeting one actor or the other?
By "based on that", do you mean by which one is closer? Does your World subclass keep references on the players? Will both players always be in the world? What are the class names involved? Show code for class of dart.
You need to login to post a reply.