Skip to content

bennbollay/godot-rope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Godot 4 2D Rope Implementation

This project creates a Rope class a variety of different ways to support physics-enabled 2D ropes in Godot 4.

Example

rope_demo_video

Usage

See test/test_rope.gd for the example usage represented here:

Fixed on both ends

Using the RopeEndPiece node as starting and/or end points, create a Rope that extends from that starting node to a specified ending node.

rope = Rope.new($RopeStartPiece)
add_child(rope)
rope.create_rope($RopeEndPiece) # rope_end_piece.global_position)

Customize the length of each line segment

# Create a rope where each segment is 5 px long
rope = Rope.new($RopeStartPiece, 5)

Towards a particular point

rope.create_rope($RopeEndPiece2.global_position)

Towards a specific end piece, but only a certain length

# Create a rope that's 10 segments long that will connect to
# the $RopeEndPiece2 if it reaches it, but will otherwise float
rope.create_rope($RopeEndPiece2, 10)

Grow the rope by five segments

rope.spool(5)

Draw a line over the rope

rope_drawer = RopeDrawSimpleLine.new(grope)
add_child(rope_drawer)

Stop drawing the line

rope_drawer.queue_free()

About

A demonstration library for a rope implementation in Godot 4 using GDScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors