376377378379380381382383384385386
vx = state.get($vx); vy = state.get($vy); assert !Double.isNaN(vx + vy); if (x > bounds.max(X) || x < bounds.min(X)) { x = min(x, bounds.max(X)); x = max(x, bounds.min(X)); vx = -vx * SPEED_BOUNCE_DAMPING; ax = 0; }
377378379380381382383384385386387
vy = state.get($vy); assert !Double.isNaN(vx + vy); if (x > bounds.max(X) || x < bounds.min(X)) { x = min(x, bounds.max(X)); x = max(x, bounds.min(X)); vx = -vx * SPEED_BOUNCE_DAMPING; ax = 0; } if (y > bounds.max(Y) || y < bounds.min(Y)) {
382383384385386387388389390391392
x = min(x, bounds.max(X)); x = max(x, bounds.min(X)); vx = -vx * SPEED_BOUNCE_DAMPING; ax = 0; } if (y > bounds.max(Y) || y < bounds.min(Y)) { y = min(y, bounds.max(Y)); y = max(y, bounds.min(Y)); vy = -vy * SPEED_BOUNCE_DAMPING; ay = 0; }
383384385386387388389390391392393
x = max(x, bounds.min(X)); vx = -vx * SPEED_BOUNCE_DAMPING; ax = 0; } if (y > bounds.max(Y) || y < bounds.min(Y)) { y = min(y, bounds.max(Y)); y = max(y, bounds.min(Y)); vy = -vy * SPEED_BOUNCE_DAMPING; ay = 0; }