2D GRAPPLE GUN QUEST: ‘Yoink’ - Solutions

Quest: 2D Grapple Gun Quest
Challenge: Yoink

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

Here’s my solution:

private void PullPlayer()
    {
        //Challenge 2:  
            joint.distance -= Time.deltaTime * grappleSpeed;
    }
3 Likes

I made some few more steps and move the “PullPlayer” method calling to the if statement that checks if the player is holding down the mouse button

private void PullPlayer()
    {
        joint.distance = Vector2.Distance(playerHand.transform.position, hit.point);
        Vector3 dir = (Vector3)hit.point - this.transform.position;
        dir.Normalize();
        transform.position += dir * joint.distance * grappleSpeed * Time.deltaTime;
    }

Here’s my solution similar to the last ones, but added an if statement to stop the player from going into the wall

Privacy & Terms