Rope
A rope from its entity to another (To), to a point in the world, or hanging loose: it hangs and sags under gravity, swings, lies over what it falls on and wraps round corners, and holds what’s tied to it no further than its Length: hang a crate or a lamp from the ceiling, tie a balloon to a box, tow a cart, swing a wrecking ball. Either end can be a body (pulled about by it, and turned if it rotates), something that doesn’t move, or the world. A player with Platformer Movement grabs a Climbable one with up, climbs it, swings on it and jumps off.
It’s a chain of short pieces worked out with the bodies that rotate, and drawn as a smooth curve. In the Scene view, drag the knobs at its ends to move them and the one at its middle to make it longer or shorter. Give it a BreakForce to have it snap when it’s pulled too hard (it then says Broke and sends its BreakMessage), or Cut it from a wire or a script.
Formerly saved as: Griff.Rope (scenes that use those names still load).
Draws itself over the whole world, under what’s pinned to the screen.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
to: text = null. What its other end is tied to, by name: the nearest entity called that. Empty ties it to a point in the world (see OtherAnchor), or leaves it hanging free with LooseEnd. (Names an entity.) (Field: an entity’s name.)anchor: [x, y] = [0,0]. Where it’s tied on this entity, from its position, in its own units (before its scale, turned with it): (0, 0) is its middle; (0, 0.5) the top of a crate 1 high. (Formerly Offset.) (Field: a vector.)otherAnchor: [x, y] = [0,0]. Where its other end is tied on what it’s tied to, in that one’s own units; tied to nothing, where that end is in the world (with LooseEnd, where it starts). (Formerly OtherOffset.) (Field: a vector.)looseEnd: true or false = false. With nothing in To, its other end hangs free rather than tied to the world: a rope to climb and swing on, a bell pull. It starts laid out towards OtherAnchor (and straight down from there for any length left over), and falls and swings from there. (Field: on or off.)length: a number = 0. How long it is, in world units: the two ends can come closer (it sags) but no further apart. 0 makes it as long as the ends are apart as the game starts. It can change while the game runs, to winch something up or let it down. (A distance: the Scene view draws it as a circle around the entity, with a handle to drag.) (Field: a number.)stiffness: a number = 1. How much it gives, from 0 to 1: 1 (the default) doesn’t stretch; lower stretches like elastic, so what hangs on it bounces (0.5 is a bungee cord, 0 a rubber band). (Field: a number.)gravityScale: a number = 1. How strongly gravity pulls it: 1 hangs and sags; 0 (a top-down game) lies where it’s put. (Field: a number.)collide: true or false = true. It meets the world: it lies on the ground, drapes over things and wraps round corners. Off, it passes through everything. (Field: on or off.)climbable: true or false = true. A player with Platformer Movement grabs it with up, climbs it at its Climb Speed, swings on it left and right, and jumps off. (Field: on or off.)
Breaking
Section titled “Breaking”breakForce: a number = 0. How hard it can be pulled before it snaps, in the units of gravity’s pull on a body (a crate of Mass 1 hanging still pulls 25). 0 never breaks. (Field: a number.)breakMessage: text = null. A message sent with Game.Send when it breaks, with the entity as its data, e.g. “RopeSnapped”. (Names a message.) (Field: a name.)broke: true or false = false. True once it has broken (pulled harder than its BreakForce, or Cut): its two halves hang from their ends. Wire it to a lamp or a gate; untick it to mend it. (Field: on or off.)
color: a color, “#RRGGBB” or “#RRGGBBAA” = “#C8A96EFF”. The rope’s color. (Field: a color.)width: a number = 0.08. How thick it’s drawn, in world units: it meets the world this thick too (at least 0.08). (Field: a number.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
Cut. Breaks it: in the middle, or above the lowest player hanging on it. Its halves hang from their ends.Mend. Joins it up again, as it was before it broke.
Outputs
Section titled “Outputs”What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.
Broke(true or false). True once it has broken (pulled harder than its BreakForce, or Cut): its two halves hang from their ends. Wire it to a lamp or a gate; untick it to mend it.Tension(a number). How hard it’s pulled as the last step ended, in the units of BreakForce.
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
tension: a number. How hard it’s pulled as the last step ended, in the units of BreakForce.otherEntity: an entity: its name, id or path. What its other end is tied to (see To): null for the world or a loose end, or when nothing has that name.worldAnchor: [x, y]. Where it’s tied on its entity, in the world.worldOtherAnchor: [x, y]. Where its other end is in the world as it’s placed: on what it’s tied to, or the point in the world (a loose end: where it starts).endIsLoose: true or false. True when its other end hangs free: LooseEnd with nothing in To, or tied to something that has gone.placedLength: a number. How long it is as placed: its Length, or (at 0) as far apart as its ends are.pointCount: a whole number. How many points it’s laid out as while the game runs (0 before), from this end to the other.
Scripts use it as Rope: its methods, events and values that aren’t saved with the scene.