I have a sprite that needs to follow the command of an arrow sprite that rotates, right now I can only make my sprite move up,down and left,right. How about diagonally? I have no Idea how to do that, the sprite also needs to move always towards outside the screen.
EDIT: So this is what I did:
Vector2 position=new Vector2();
public void update(){
//getAngle() is the return value from another class
position.set(MathUtils.cosDeg(cannonObj.getAngle()),MathUtils.sinDeg(cannonObj.getAngle()));
sprite.setPosition(position.x,position.y);
}
What happens is that when I rotate the arrow the main sprite is just moving like the arrow(moving in a circular motion).
//I also tried this
position.scl(2,2);
or
position.translate(2,2);