05-02-2009 04:23 PM
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,
Solved! Go to Solution.
05-02-2009 04:30 PM
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.
05-02-2009 06:11 PM
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.
05-02-2009 08:04 PM - edited 05-02-2009 08:06 PM
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.
05-02-2009 08:08 PM
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,
05-02-2009 09:24 PM
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?
05-03-2009 01:07 AM
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!
05-03-2009 01:11 AM - edited 05-03-2009 01:16 AM
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
05-03-2009 01:58 AM
very cool I like it.
thank you for sharing that with me
05-03-2009 02:17 AM
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