A small Pong game written in V using the gg and sokol.audio modules.
Features
- Proportional Resizing: The game scales ball, paddles, and speeds based on the window size.
- Audio Effects: Synthesized sounds for wall bounces, paddle hits, and scoring.
- Modern-Retro UI: Deep blue background with vibrant accent colors.
- Real-time Metrics: Displays ball speed in m/s (assuming a 10m wide playfield).
AI use note:
This example was created by Google gemini-cli Auto (Gemini 3), using the following prompts:
- create a small Pong game using gg in examples/gg/pong.v .
- the game should start not paused. Show the current score for each player on the corresponding
side of the screen. Show the current vertical position for each player below the score too.
Show a green "PAUSED, press space to unpause" label in the bottom middle of the screen,
when the game is paused.
Show a yellow label "Press space - pause; W/S - left player; Up/Down - right player." in the
bottom middle of the screen, when the game is not paused.
- make the score and position labels green
- make the ball be a filled white circle
- make the paddles be slightly rounded
- make the pause key work when a key_down event is received; it is not like the other keys
- make the background very dark blue
- be a good game designer, and tweak the colors and positions of all the screen elements,
if they do not look good.
- move the bottom status text even more down, so that the last stripe of the center line does not
intersect it. Move the paused label in the center of the screen and make it bigger
- move the paused text about 80 pixels to the top; make the bottom status text slightly bigger
- move the paused text about 30 pixels down
- use the
sokol.audio module and add simple sound effects to the game: when the ball bounces
on a wall, it should produce a ping sound; when the ball bounces on a paddle it should produce
a pong sound (slightly lower pitched); when the ball escapes behind a paddle, and the game
resets, produce a low pitched buzzing sound
- the sounds work fine, but there is a very slight click at the end, that is especially
pronounced at the end of the buzz sound
- the buzz sound still has a slight click at the end
- make the left paddle bight red, and the right paddle bright blue
- assume that the whole playfield is 10 meters wide (5 on the left and 5 on the right side).
Calculate the ball speed. Show the ball speed in the top center of the screen
(for example
Ball: 5.2 m/s, note it should be always rounded at
the first digit after the dot (i.e. show 5 as Ball: 5.0 m/s).
- make sure to resize the ball, paddles and playfield proportionally, when the screen
is maximized
- append all my current user prompts to examples/gg/pong/README.md