Overview
This example is a simple implementation of the classic game Pong. The user interface consists of an array of LEDs and a keyboard to control the position of the paddle.
Description
This example is a simple implementation of the classic game Pong. The game works on main principle that the ball has four attributes, x position, y position, x velocity and y velocity. You can move the ball with this pseudocode:
Ball x position = Ball x position + ball x velocity
Ball y position = Ball y position + ball y velocity
When the ball reaches a boundary or paddle, you can bounce the ball by changing its direction.
Ball x velocity = - Ball x velocity
Ball y velocity = - Ball y velocity
Requirements
- LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code
- Open Pong Game.lvproj
- Run MAIN game.vi
- Click run.
- Use the keyboard to move the paddles. Press A and D to move the player 1 paddle and LEFT and RIGHT to move player 2 paddle.
Additional Information or References
Front Panel

VI Snippet

**This document has been updated to meet the current required format for the NI Code Exchange.**