Skip to content

Lane

namespace Griff.Modules.PhysicsGames;
public sealed class Lane : Component, IDrawEffect, IPlaytestReport

A pinball rollover lane, with no code: a ball rolling through it scores its Points and lights it up. Once every lane in its set (those inside the same entity) is lit, the set scores its CompletePoints and sends CompleteMessage, and they all go out ResetAfter seconds later. Pressing a flipper moves the lit lanes along, one lane left or right (FlipperChanges), to line the gap up with the ball.

Put it on a trigger the ball rolls through, at least a ball’s width long. Unlit, its sprites are drawn darker. Its Lit and Passes outputs are for a wire or a Counter; nothing counts while a Tilt covering it has tilted.

This is a component: its saved properties are on its component page.

public string? CompleteMessage { get; set; }

A message sent as every lane in its set is lit, with the set’s points as its data, e.g. “Score”.

public int CompletePoints { get; set; }

What lighting every lane in its set (those inside the same entity) scores, as the data of its Complete Message.

public bool FlipperChanges { get; set; }

Pressing a flipper moves the lit lanes of its set along: the left flipper one lane to the left, the right one to the right (round from the end to the other), so the player lines up the unlit one with where the ball will go.

public string? Layers { get; set; }

The collision layers that light it, e.g. “Ball”. Empty is any body (but flippers).

public bool Lit { get; set; }

True once a ball has rolled through, until its set goes out (or its Reset action).

public string? Message { get; set; }

A message sent with Game.Send as a ball rolls through, with its Points as its data.

public bool Occupied { get; set; }

True while something is in it (so a ball sitting in it counts once). Set by the game.

public int Passes { get; set; }

How many times a ball has rolled through.

public int Points { get; set; }

What a ball rolling through scores: the data its Message carries. 0 sends the entity.

public float ResetAfter { get; set; }

Seconds after its set is complete before they all go out; 0 leaves them lit (until Reset).

public float ResetIn { get; set; }

Seconds until its set goes out; 0 when it isn’t due to. Set by the game.

public string? Sound { get; set; }

A sound played as a ball rolls through, e.g. “Sounds/rollover.wav”.

public void Light()

Lights it as if a ball rolled through, scoring nothing (a set completed this way still scores).

public void Reset()

Puts it out.

public override bool Uses(string property)
public event Action<Lane, Entity>? Passed

Raised as a ball rolls through, with the ball.