LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Classic Pong

Solved!
Go to solution

So,  I have started to make my classic pong game and I was wondering if anyone had any suggestions as to what I should use I have uploaded the code I am using so far so any suggestions are welcome

 

thanks guys/gals,

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 1 of 22
(7,069 Views)

here are some of the things I was thinking,

 

use the mouse arrows up and down to move the paddle.

 

also, make a computer AI, but first I would like to make it to where A player can choose to play another person so you would have a radio box asking player vs player and the next selection would be player vs computer.

 

and if it is player vs player use the keys W and S to move thier paddle.

 

also I figure if I set a max and min for the array I can hold the ball within those boudries so say if it hit pong[0] it will "bounce off" the wall and this will also happen for the maximum.

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 2 of 22
(7,066 Views)

Huge 2D array indicators of modern controls are relatively expensive to redraw. See how long it takes to click a button on/off or resize the front panel. I would recommend a picture indicator instead.

 

If you want to use a 2D array of booleans, maybe use classic controls. You should initialize the 2D array at a fixed size and keep it in a shift register. Same with the two scores.

 

(Your FOR loop makes no sense: You create a 1D array with one single TRUE element, replace it with a TRUE (?), and built a 1xN 2D array at the loop boundary. Why?)

 

Get rid of all that unecessary code. ( mostly value property nodes, etc.). Since you get the score out of the event structure, just tap into the wire going to the indicator. Same for the string indicator! All the code below and to the right of the event structure can be combined and rewritten without any value property nodes.

Message 3 of 22
(7,040 Views)

OK, here's a quick draft (LV 8.6) with a few suggestions on data structures and algorithms. For demonstration,  the ball bounces around randomly and scores are incremented when the sides are hit. There is no user interaction.

 

All you need to do is add the user interaction by reading some keys to move the padles, place them also into the array, and watch for collisions. Then deflect the ball or score accordingly. 😉

 

Shouldn't be too difficult. 😄

 

Notice there are no property nodes or local variables and all operations are done on arrays if possible to keep things simple. See if it makes sense to you.

Message Edited by altenbach on 05-02-2009 06:06 PM
Message 4 of 22
(7,028 Views)

I see I created a control bool variable array and yes it is slow to redraw so I figure I will use picture varable if the array will be so slow

 

and I was going to put the score in the event, but right now that was not to important to me what was important is getting the programs main functions working, but because I do not know that much about the picture variable I will have to read alot on it.

 

thank you,

 

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 5 of 22
(7,026 Views)

here is my promo control what I want to do is make it to where the up and down buttons control the Array2

for example:

 

if arrray2 index is [0] and than you hit the down button and index[0] is set to false and index[3] is set to true

 

does this sound plasable?

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 6 of 22
(7,013 Views)

Hi,

 

I made one just for fun while i was an intern at NI, India.

What i am attaching is just an coarse vi. you can fine tune it according to your need.

 

Later i developed it such that it can be played by two players over LAN using shared varaibles ;).

And then even interfaced it with a Wii mote 🙂

 

This is just to give you a basic idea.

The speed keeps on increasing linearly, hehe, but you can always change that.

Hope you like it. 

 

Cheers! 

0 Kudos
Message 7 of 22
(6,989 Views)

sorry i forgot to attach the vi, i tried editing the post but it was giving some unexpected error.

 

here is the link to it http://ujjvalshah.synthasite.com/resources/ACC%20new%20speed.vi 

Message Edited by Ujjval Shah on 05-03-2009 01:16 AM
Message 8 of 22
(6,987 Views)

very cool I like it.

 

thank you for sharing that with me

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 9 of 22
(6,971 Views)

Hey guys I am stuck on making the paddle moving in the array I know I am prolly meesing up on the for loop and the array constant, but I don't know what else I could do.

 

any help

 

heres my code: 

 

thanks guys/gals

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 10 of 22
(6,969 Views)