RedSkull
RedSkull

Reputation: 11

2D Top Down Slime Jump

I am trying to make a Top down game with the main character as a slime. i am trying to get it so when the player clicks with the mouse the slime jumps to that location and actually looks like a jump.

if you want me to add more information please let me know

I have tried using a Vector2.MoveTowards for mainly the x and a bit the y and then using a Sine Wave to try and get a jump motion but i can't get it right.

Vector2 moveTo = Vector2.MoveTowards(transform.position, targetPos, 5 * Time.deltaTime);

        transform.position = new Vector2(moveTo.x, /*moveTo.y +*/ Mathf.Sin((transform.position.x - startXPos) / (targetPos.x - startXPos)));

Upvotes: 1

Views: 58

Answers (0)

Related Questions