public void restart() { start = true; ballx = 400; bally = 250; ballrx = 2; ballry = 2; score = 0; if (p2) { ballx2 = 300; bally2 = 250; ballrx2 = -2; ballry2 = -2; player2 = 200; score1 = 0; score2 = 0; } score = 0; nbricks = r * c; player = 400; b = new bricksgen(r, c); }
/* public void move() * { * bool pause = false; * // if (KeyInputManager.getKeyState(Keys.Escape)) { Application.Exit(); } * if (KeyInputManager.getKeyState(Keys.ControlKey)) { if (lvl < 10) nextlvl(); } * if (KeyInputManager.getKeyState(Keys.Enter) && lvl < 10) * { * start = true; * if (nbricks == 0) * nextlvl(); * } * if (KeyInputManager.getKeyState(Keys.S)) * { * if (nbricks == r * c || pause == true) * start = true; * } * if (KeyInputManager.getKeyState(Keys.P)) * { * start = false; * } * if (KeyInputManager.getKeyState(Keys.Space) && lvl < 10) { restart(); } * if (KeyInputManager.getKeyState(Keys.Right)) * { * * if (player < 561) * player += 20; * } * if (KeyInputManager.getKeyState(Keys.Left)) * { * if (player > 0) * player -= 20; * } * if (KeyInputManager.getKeyState(Keys.D)) * { * * if (player2 < 561) * player2 += 20; * } * if (KeyInputManager.getKeyState(Keys.A)) * { * if (player2 > 0) * player2 -= 20; * } * * }*/ public void nextlvl() { ballx = 400; bally = 250; ballrx = 2; ballry = 2; if (p2) { ballx2 = 200; bally2 = 250; ballrx2 = -2; ballry2 = -2; player2 = 200; score1 = 0; score2 = 0; } score = 0; r += 1; c += 1; player = 400; lvl++; nbricks = r * c; b = new bricksgen(r, c); }
public BricksPanel() { nbricks = r * c; this.DoubleBuffered = true; b = new bricksgen(r, c); }