rmp::behavior::Ball
Bounces, keeps its pace, and leaves a paddle at an angle that depends on where it hit. STARTS STILL — see the note at the top of this file.
ball.add<rmp::behavior::Ball>({ .speed = 320 });
ball.apply_force({ 1, 0.35f }); // the serve, and it is the game's_update normalises the velocity to speed ONLY when it is not zero, and the two properties that fall out of that are what make the serve one line: only the DIRECTION of the push counts, so nobody has to think about magnitudes, and velocity = {} is a stable state, so stopping the ball between points is one assignment rather than removing the behavior.
Added to an object with add<rmp::behavior::Ball>(); the framework calls its _ready, _collision, _update with the object it is on.
Fields
| Field | Type | Default | What it is |
|---|---|---|---|
speed | float | 300 | The pace it KEEPS, not the one it leaves at |
max_bounce_deg | float | 60 | How far a hit near the end of a paddle tilts it |
speed_up | float | 1.02f | Per bounce off a solid. 1 = constant |