Example Code

Object Oriented Cannon Game

Code and Documents

Attachment

The Cannons game demonstrates use of LabVIEW's built-in object-oriented support and emphasizes the use of encapsulation and modularity. These principles help reduce the number of wires needed in high level parts of the program and make changing subVIs without the need to change the code using them easier. All data is passed by value, however pass by reference is possible and can be seen on discussion forms and developer communities at National Instruments website and other locations on the web. The main Cannons VI uses a producer-consumer architecture and event structure to react to user inputs.

The first player to get 3 hits wins.

CannonGame.bmp

Justin Parker
National Instruments
Product Support Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors