Skip to content

Flipper

A pinball flipper, with no code: a paddle on a HingeJoint that snaps up while its button is held and drops back as it’s let go, hitting the ball hard and the same every time. How far it swings is its hinge’s limits (it rests against one and swings up to the other; a hinge without limits is given its side’s, resting as it starts and swinging 55 degrees up); how fast and how hard are its Speed and Strength. Its body rotates, and should be heavier than the ball (Entity > Genres > Physics Games > Flippers makes a pair).

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.

It’s held up by its Action (Left Flipper: Left Shift, Z, the left shoulder or trigger; Right Flipper: Right Shift, /, the right shoulder or trigger), by the mouse or a finger held down on its side of the flippers, by a switch or a wire into its Power, or for a moment by its Flip action. A Tilt that has tilted drops it and keeps it down until the ball drains. A fast ball doesn’t go through it: the game works out where the two will meet within each step.

Requires: HingeJoint (what it swings on: its limits are how far)

Works with: Tilt (tilted, it drops and stays down until the ball drains); TurnTaker (its side: flipped on its side’s turn)

Takes the player’s input only while it has focus (its Controllable): its Focus action hands it the input and takes it from everything else the same player plays.

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.

  • side: one of Left, Right = “Left”. Which way it swings up: Left (a flipper pointing right, swinging up anticlockwise) or Right. (Field: one of its values.)
  • speed: a number = 2000. How fast it swings, in degrees a second, up as it’s pressed and down as it’s let go: 2,000 snaps it up in a few hundredths of a second, as a real flipper does. (Field: a number.)
  • strength: a number = 4000. How hard it swings (the most its hinge’s motor turns it with): enough to hold the ball cradled on it, and to hit it as hard each time whatever it was doing. Lower, a heavy ball slows it down. (Field: a number.)
  • action: text = null. The input action that holds it up. Empty: Left Flipper or Right Flipper by its Side (Left or Right Shift, Z or /, a shoulder or trigger of the gamepad). (Names an input action.) (Field: a name.)
  • touch: true or false = true. The mouse button or a finger held down on its side of the flippers (left of the middle between them, for one on the left) holds it up too: on a phone, a finger on the left of the screen flips the left flipper, and a finger on each side holds both up. (Field: on or off.)
  • controllable: true or false = true. Untick it to have it ignore the keys, mouse and gamepad (its actions, a wire and scripts still work): another part of the scene has the player’s input. Its Focus action ticks it and unticks it on everything else the player plays. (Field: on or off.)
  • raised: true or false = false. Held up by a switch or a wire into its Power (or a script), whatever the buttons say. (Field: on or off.)
  • sound: text = null. A sound played as it swings up, e.g. “Sounds/flip.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • message: text = null. A message sent with Game.Send as it swings up, with the flipper as its data, e.g. “Flipped”. (Names a message.) (Field: a name.)
  • pressed: true or false = false. True while its button (the keys, the mouse, a finger) is held down. Set by the game. (Field: on or off.)
  • flipFor: a number = 0. Seconds its Flip action still holds it up. Set by the game. (Field: a number.)
  • up: true or false = false. True while it’s swinging up or held up: pressed, powered or flipped, and not tilted. Set by the game. (Field: on or off.)
  • flips: a whole number = 0. How many times it has swung up. (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”).

  • Flip. Swings it up for a moment and lets it drop: a flipper a Trigger, a wire or the beat flips.
  • Raise. Holds it up until its Lower action (or until it’s tilted).
  • Lower. Lets it drop, held up by its Raise action or a wire no longer.
  • Focus. Gives its entity the player’s input: whatever there and inside it has focus, and everything else the same player plays loses it (a platformer’s player stops on the arrow keys while a board takes them).

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.

  • Up (true or false). True while it’s swinging up or held up: pressed, powered or flipped, and not tilted. Set by the game.
  • Flips (a whole number). How many times it has swung up.

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

  • inputAction: text. The input action that holds it up: its Action, or Left Flipper or Right Flipper by its side.

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