#region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; #endregion namespace pong { class ball { public int ballX; public int ballY; private int trajX; private int trajY; public void checkWalls() { if (ballX < 1) { trajX = trajX + 2; } if (ballX > 775) { trajX = trajX - 2; } ballX = ballX + trajX; if (ballY < 575) { trajY = trajY + 3; } if (ballY > 10) { trajY = trajY - 3; } ballY = ballY + trajY; } public void checkPaddles(int playerPos) { if (ballX > playerPos && ballX < playerPos + 139 && ballY < 500) { trajY = trajY - 2; } } } }