To download NI software, including the products shown below, visit ni.com/downloads.
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
Steps to Implement or Execute Code
Additional Information or References
Front Panel
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.