Challenge: improve your pong game
Now it's your turn to make some improvements to the game; maybe you can change the picture or sound, or adjust the gameplay. If you have a gamepad controller, you can also try to add rumble support to it. And if you read this book, you should indeed have a gamepad, even if you do not have Xbox 360; many xNa examples require the Xbox 360 controller, in addition, some games use an Xbox 360 controller, which is more fun than a keyboard.
Here is how to add rumble support to gamepad:
Gamepad. setvibration (playerindex. One, leftrumble, rightrumble );
When the ball hits the racket, use the aboveCodeIt will shake the Controller for a while (left rumble and right rumble use the same value, so that the entire controller will vibrate ). When a player loses his or her life, he or she can also shake it. This Shake takes a longer time and is more intense.
You can view the project in this chapter to see the solutions to the challenges. Your solution does not have to be the same, but it may be helpful or even a shortcut to solve a specific problem.
Enjoy the xNa pong game!