9 – Rope Swinging

Rope Swinging is the final Power-Up from my initial design plan and arguably the most complex one as not only does it require working with Unity Physics but also deals with procedural instantiated objects which I don’t have much experience in.


From my research I found that there’s two distinct schools surrounding this whole idea: rope swinging and grappling hooks.
Rope Swinging are in games like Hanger: you shoot a rope and swing on it.
Grappling Hook are in games like Terraria or Windlands: you shoot a rope and get pulled towards it – the rope itself is high-tension (aka not ‘floppy’ but a straight line)
While both are pretty good options I was aiming for the Indiana Jones-style rope swinging which could also allow versatility in pulling objects or rapelling/absailing.


Eventually I found a good tutorial that helped achieve the basics of the Rope Swinging variant, though I would later need to build and iterate upon it to make it my own.

The Setup




This Setup was arguably more complex than the other two Power-Ups, in brief I have a base Power-Up object playerRope (like playerSpikes or playerParachute) which contain the script hookThrow.

hookThrow relates to the ropeHook prefab and the ropeNode prefab, the ropeHook prefab also has its own script tied to it called hookRope which.



The Code



This script handles the actual throwing of the hook and its relation to the player’s controls – when future implementation of mobile controls are done it’ll be here.



The real bread and butter of the code lies in the hookRope script, above is an excerpt showing how Nodes are created.


As you can see there’s still some problems afoot which i’ll hopefully deal with next post.

Leave a Reply

Your email address will not be published. Required fields are marked *