LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Classic Pong

Solved!
Go to solution

Hello altenbac!

 

I am a LabView student also creating a pong game, I was wondering if you could explain some parts of your code to me? I read this thread and another thread where you helped a different person with creating their own game (they decided to take out the velocities and simplify it a bit).. I would love to use your code as a reference (I will be controlling the paddles with a joystick controller so it will be quite a bit different at the end), I just had a couple questions:

1) What is that For loop on the left (that negates a value and connects it to Select) doing?

2) What is that nested Case structure (0,29) supposed to do?

3) Why have you set the iteration of that For loop that controls paddle display to 5?
Sorry for commenting on such an old post, I'd really appreciate the help!! Thank you so much.

0 Kudos
Message 21 of 22
(1,236 Views)

PhysicsDude93 wrote:

1) What is that For loop on the left (that negates a value and connects it to Select) doing?


Well, you could take it out and see what happens... 😄

It handles the reflection off the walls. Whenever the x, y, or both are out of range, the speed in that direction is negated.


PhysicsDude93 wrote:

2) What is that nested Case structure (0,29) supposed to do?


It increments the number of wins for the winning side.


PhysicsDude93 wrote:

3) Why have you set the iteration of that For loop that controls paddle display to 5?


To redraw the paddle, we need to fill five squares, the lenght of the paddle. Change it to 3 or 7 and see how the new paddle changes.

 

There are plenty other ways to do all this. Just experiment with it.

 

Message 22 of 22
(1,212 Views)