← back to the arcade

Pong — remix it

This is the real game code's behavior. Drag the sliders — you are editing the same numbers that live in pong.rl. There is no "run" button because it is always running.

The four numbers

This page runs a faithful preview of the template's one system, IntegrateBall: move by velocity, flip at the walls. The same file compiles to a provenance-stamped WASM module for the real engine.

See the actual game code this mirrors
component Ball { radius: f32 = 8.0 }
component Position { x: f32, y: f32 }
component Velocity { vx: f32 = 220.0, vy: f32 = 160.0 }
resource Arena { width: f32 = 640.0, height: f32 = 360.0 }

system IntegrateBall reads(Ball) writes(Position, Velocity) {
    for entity in query(Ball, Position, Velocity) {
        e[Position].x = e[Position].x + e[Velocity].vx * dt;
        e[Position].y = e[Position].y + e[Velocity].vy * dt;
        if e[Position].x <= 0.0 or e[Position].x >= arena.width  { e[Velocity].vx = -e[Velocity].vx; }
        if e[Position].y <= 0.0 or e[Position].y >= arena.height { e[Velocity].vy = -e[Velocity].vy; }
    }
}