java - How to stop vector movment -


i made program player moved starting point end point (i'll referencing "reddot end point) push of button using vectors. player moves end point fine, instead of stopping @ point moves past it. can see in update function vector movement.

 public void update(float dt) {      if (inputmanager.istriggered(keyevent.vk_enter)) {         enter += 1;     }     if (inputmanager.istriggered(keyevent.vk_back_space)) {         enter -= 1;     }      if (enter == 1) {          vec2 direction = new vec2(0.0f, 0.0f);         direction.setx(-reddot.getpositionx() - 100);         direction.sety(reddot.getpositiony() - 100);         direction.normalize();         cloudplayer.setvelocity(vec2.scale(direction, speed));     }  } 

i tried things changing speed variable after amount of time doesn't work


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -