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
Post a Comment