Posted on March 22, 2010.
Ready Java program using the necessary BADDLY! PLZ PLZ? My task is to lead the program of Pong. I need to 2mororw if Im going to graduate and i cannot get 2 work.
/ / Pong Xtreme
import java.applet .*;
import java.awt .*;
import java.awt.event .*;
XtremePong public class extends Applet implements Runnable, ActionListener
(
/ / Inst. Variables
Play button, instructions, Pro;
int screen, click ballx, Bally, BasicX, basicy, Movex, ballspeedx, ballspeedy;
advx int, advy, advx2, advy2, ballx2, bally2;
int ballspeedx2, ballspeedy2, evil1, evil2, evilx, evilx2;
playerscore int = 0;
aiscore int = 0;
/ / Img
Thread animator = new Thread (this);
public void init ()
(
setLayout (null);
setSize (600, 500);
setbackground (Color.Black);
setForeground (Color.White);
Add (play = new Button ("player"));
play.setLocation (50, 470);
play.setSize (100, 25);
play.setBackground (Color.Black);
play.setForeground (Color.gray);
play.setActionCommand ("r");
play.addActionListener (this);
Add (play = new Button ("multi-player"));
pro.setLocation (250, 470);
pro.setSize (100, 25);
pro.setBackground (Color.Black);
pro.setForeground (Color.gray);
pro.setActionCommand ("h");
pro.addActionListener (this);
Add (instructions = new Button ("Instructions"));
instructions.setLocation (450, 470);
instructions.setSize (100, 25);
instructions.setBackground (Color.Black);
instructions.setForeground (Color.gray);
instructions.setActionCommand ("i");
instructions.addActionListener (this);
ballx = (this.size (). width / 2-50);
Bally = (this.size (). Height / 2-50);
BasicX = (this.size (). Width / 2-40);
baiscy = (this.size (). height / 2-60);
ballx2 = 450;
bally2 = 310;
advx = (this.size (). width / 2-50);
advy = (this.size (). height / 2 to 25);
advx2 = (this.size (). width / 2-550);
advy2 = (this.size (). height / 2-40);
Movex = 20;
evil1 = 70;
evilx = 296;
evil2 = 380;
evilx2 = 296;
ballspeedx = 2;
ballspeedy = 2;
ballspeedx2 = -2;
ballspeedy2 = -3;
)
public void paint (Graphics g)
(
if (screen == 0)
/ / TITLE
(
g.setFont (new Font ("Freestyle Script", Font.PLAIN, 100));
g.setColor (Color.orange);
g.fillOval (275, 120, 10, 10);
g.drawString ("Pong", 210, 160);
g.setFont (new Font ("Freestyle Script", Font.PLAIN, 50));
g.drawString ("BY THE OFFICER Fenton", 180, 270);
g.setColor (Color.Red);
g.drawString ("Revolution", 220, 215);
)
if (screen == 1)
/ / The game
(
remove (game);
remove (instructions);
suppress (pro);
g.drawString ("Pong", 285, 20);
g.setColor (Color.White);
g.drawRect (40, 40, 520, 420);
g.drawLine (40, 40, 560, 40);
g.drawLine (40, 40, 40, 460);
.