Hi i'm implementing a small java program where we have the game running in an applet. After each turn I want the applet to reset to the original setting for the next turn. Basically the game is a football being kicked into the goal. After the goal is made/missed the ball has to go back to the initial starting point. But I can seem to reset it. this is what i'm doing so far.
public KeyPress() {
super("Key Press Event Frame");
Panel panel = new Panel();
Frame myFrame = new Frame("Hello World Applet Holder");
label = new Label();
txtField = new TextField(20);
for (int i = 0; i < 5; i++) {
myapplet = new HelloWorld();
//myapplet.setSize(700, 700);
txtField.addKeyListener(new MyKeyListener());
add(label, BorderLayout.NORTH); //the text abovr text box
add(myapplet, BorderLayout.CENTER); // the box
panel.add(txtField, BorderLayout.SOUTH);
add(panel, BorderLayout.WEST);
setSize(1000, 400); // main window size
setVisible(true); // makes sureit shows
try {
while (fwdCount < 38 && Kcollision == false) {
Thread.sleep(70);
update = false;
myapplet.repaint();
}
B_up = false;
B_down = false;
G_up = false;
G_down = false;
Kcollision = false;
Kgoal = false;
update = false;
srcAdd = -1;
data = 0;
Thread.sleep(1000); // end of game sleep
} catch (Exception e) {
}
}
System.exit(0);
}