Skip to content

Bouncer

A spring, jump pad or bumper, with no code: bodies touching it from the Direction side are sent flying that way at Strength. Works on solid colliders (land on it) and triggers (pass through it). A PlatformerMovement launched by it gets its air jumps and dash back.

Requires: Collider

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.

  • strength: a number = 20. How fast it sends things off, in units per second. (Field: a number.)
  • direction: [x, y] = [0,1]. Which way it sends them: (0, 1) is up, (1, 0) right, (1, 1) up and to the right. (A direction, x right and y up: [0, 1] is up, [1, 0] right, [1, 1] up and to the right. The Inspector has a compass of the eight ways; with Distance Handles the Scene view draws it as an arrow to drag round.) (Field: its own editor: Direction.)
  • layers: text = null. The collision layers it launches, e.g. “Player”. Empty launches any body. (Names collision layers: their names, separated by commas.) (Field: a name.)
  • sound: text = null. A sound played on each bounce, e.g. “Sounds/boing.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • squash: true or false = true. Squash and stretch its entity with each bounce. (Field: on or off.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • way: [x, y]. The Direction as a unit vector (up if it’s zero).

Scripts use it as Bouncer: its methods, events and values that aren’t saved with the scene.