Skip to content

Bumper

A pinball bumper, with no code: whatever touches it is knocked away hard, at Strength, as it flashes, pops, plays its Sound and scores its Points. A round one (a pop bumper) knocks things straight away from its middle; give it a Direction and it’s a slingshot kicker, knocking whatever touches its kicking side that way.

Part of the Physics Games module: Physics puzzlers: a Slingshot to pull back and launch shots from, and Breakable things (planks, panes, blocks, pigs) that crack and break on hard knocks; a LevelGoal that wins a level once its targets are down (with a bonus for the shots left, and one to three stars) or loses it once the shots run out; a Slingshot and a Tower to make from the Entity menu (Genres, Physics Games); and the Physics template, levels of wood, glass and stone to knock down.

Its Message carries its points to a Counter keeping the score, and its Hits and Lit outputs are for a wire, a Counter or a Bar: a bumper that hurts a boss each time it’s hit. It knocks nothing while a Tilt covering it has tilted, or with its On unticked (a switch or a wire can turn it on and off); then it’s just a wall.

Requires: Collider (what the ball hits: solid, round for a pop bumper)

Works with: Counter (keeps the score from its Message (on another entity)); Tilt (tilted, it knocks nothing and scores nothing)

Changes how its entity is drawn (a tint, a shake or drawing it on top).

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 = 16. How fast it sends what touches it off, in world units a second. (Field: a number.)
  • direction: [x, y] = [0,0]. Which way it knocks things, in its own space (turned with it): (0, 0), the default, knocks them straight away from its middle, as a pop bumper does. Set it, e.g. (0.85, 0.5), for a slingshot kicker: it knocks only what touches its side facing that way, that way. (A direction, x right and y up: [0, 1] is up, [1, 0] right, [1, 1] up and to the right, in its own space (turned with the entity); [0, 0] is straight away from its middle, as a pop bumper knocks. 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 knocks, e.g. “Ball”. Empty knocks any body (but flippers). (Names collision layers: their names, separated by commas.) (Field: a name.)
  • recover: a number = 0.08. Seconds after a knock before it knocks again: a pop bumper’s moment to recover. (Field: a number.)
  • on: true or false = true. It knocks things away. Untick it (or turn it off with a switch or a wire into its Power) and it’s just a wall: no knock, no points. (Field: on or off.)
  • points: a whole number = 100. What a knock scores: the data its Message carries, for a Counter keeping the score. 0 sends the entity. (Field: a number.)
  • message: text = “Score”. A message sent with Game.Send as it knocks something away, with its Points as its data. (Names a message.) (Field: a name.)
  • sound: text = null. A sound played as it knocks something, e.g. “Sounds/bumper.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • flashColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFD9D9”. The color its sprites flash as it’s hit; clear flashes none. (Field: a color.)
  • flashTime: a number = 0.15. How long it stays lit (its Lit output on, its sprites flashed) after a hit, in seconds. (Field: a number.)
  • pop: a number = 1.15. How much bigger it pops as it’s hit, springing back: 1.15 is a little pop, 1 none. (Field: a number.)
  • hits: a whole number = 0. How many times it has knocked something away. (Field: a number.)
  • litFor: a number = 0. Seconds it stays lit for. Set by the game. (Field: a number.)
  • resting: a number = 0. Seconds until it can knock again. Set by the game. (Field: a number.)

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”).

  • Flash. Lights it up and plays its sound, as if hit, knocking nothing: a light show on the beat.

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.

  • Hits (a whole number). How many times it has knocked something away.
  • Lit (true or false). True for a moment after each hit: for a light, a wire or a script.

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

  • lit: true or false. True for a moment after each hit: for a light, a wire or a script.
  • worldDirection: [x, y]. The way it knocks things in the world, for a kicker (its Direction turned with it); zero for a pop bumper.

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