This simple game of PONG is based on only four points: The ball (A), the rectangle (B, C) and the moving pad (D). Only two scripts are needed : the initialization script (Start button) and the update script (time slider).
[b]This is the script associated with the [i]Start[/i] button[/b] SetValue[in, false] SetValue[out, false] SetValue[score, 0] SetValue[speed, 0.2] SetValue[dx, 1] SetValue[dy, 1] SetValue[A, round((B+C)/2)] StartAnimation[] [b]This is the script associated with the [i]time[/i] slider[/b] SetValue[A, A+(dx, dy)*speed] If[x(A)<=x(B), SetValue[dx, abs(dx)]] If[x(A)>=x(C), SetValue[dx, -abs(dx)]] If[y(A)>=y(C), SetValue[dy, -abs(dy)]] If[y(A)<=y(B), If[x(A)>=x(D)-L && x(A)<=x(D)+L, SetValue[in, true],SetValue[out, true]]] If[in, SetValue[dy, abs(dy)]] If[in, SetValue[score, score+1]] If[in, SetValue[speed, speed+0.1]] If[out, StartAnimation[false]] SetValue[in, false]