" + " Player 1:
UP = up arrow key
" + " DOWN = down arrow key
" + " LEFT = left arrow key
" + " RIGHT = right arrow key
" + " Player 2:
UP = W
" + " DOWN = S
" + " LEFT = A
" + " RIGHT = D
" + " Player 3:
UP = U
" + " DOWN = J
" + " LEFT = H
" + " RIGHT = K
" + " Player 4:
UP = 8 on numberpad (NUMLOCK ON)
" + " DOWN = 5 on numberpad (NUMLOCK ON)
" + " LEFT = 4 on numberpad (NUMLOCK ON)
" + " RIGHT = 6 on numberpad (NUMLOCK ON)
" + "
" + " Quit = Q
" + " Pause = P
" + "
The Objective of this game is to capture the flag of the opposing team.
" + "The teams are split into groups of 2 where on either side there is an attacker and a defender.
" + "The attacker on both side is allowed to roam around the screen and try to" + "
avoid being shot by the defender and at the same time try to grab the flag" + "
from the base of the other team
"); //buttons Fplay = new JButton("PLAY"); Finstruct = new JButton("INSTRUCTIONS & CONTROLS"); Fexit = new JButton("EXIT"); Iback = new JButton("<< BACK"); Cok = new JButton("OK"); Cok2 = new JButton("OK"); Ccont = new JButton("CONTINUE >>"); Wback = new JButton("<< BACK"); Wcont = new JButton("CONTINUE >>"); Lback = new JButton("<< BACK"); Lcont = new JButton("CONTINUE >>"); Oback = new JButton("<< BACK"); Obegin = new JButton("BEGIN!"); p1 = new JButton(new ImageIcon("alex1.jpg")); p1.addActionListener(new myActionListener()); p1.setToolTipText("The mean machine - Alex"); p2 = new JButton(new ImageIcon("timmy1.jpg")); p2.addActionListener(new myActionListener()); p2.setToolTipText("The dominator - Timmy"); p3 = new JButton(new ImageIcon("ben1.jpg")); p3.addActionListener(new myActionListener()); p3.setToolTipText("The Terminator - Ben"); p4 = new JButton(new ImageIcon("pye1.jpg")); p4.addActionListener(new myActionListener()); p4.setToolTipText("Mr Incredible - Pye"); g1 = new JButton(new ImageIcon("gun1.gif")); g1.addActionListener(new myActionListener()); g1.setToolTipText("Pistol"); g2 = new JButton(new ImageIcon("gun2.gif")); g2.addActionListener(new myActionListener()); g2.setToolTipText("Machine Gun"); g3 = new JButton(new ImageIcon("gun3.jpg")); g3.addActionListener(new myActionListener()); g3.setToolTipText("Rifle"); g4 = new JButton(new ImageIcon("gun4.jpg")); g4.addActionListener(new myActionListener()); g4.setToolTipText("Shotgun"); g5 = new JButton(new ImageIcon("gun5.jpg")); g5.addActionListener(new myActionListener()); g5.setToolTipText("Uzi"); stg1 = new JButton(new ImageIcon("space.jpg")); stg1.addActionListener(new myActionListener()); stg1.setToolTipText("Space"); stg2 = new JButton(new ImageIcon("desert.jpg")); stg2.addActionListener(new myActionListener()); stg2.setToolTipText("Desert"); stg3 = new JButton(new ImageIcon("ocean.jpg")); stg3.addActionListener(new myActionListener()); stg3.setToolTipText("Ocean"); stg4 = new JButton(new ImageIcon("fire.jpg")); stg4.addActionListener(new myActionListener()); stg4.setToolTipText("Fire"); stg5 = new JButton(new ImageIcon("woods.jpg")); stg5.addActionListener(new myActionListener()); stg5.setToolTipText("Woods"); resume = new JButton("RESUME"); quit1 = new JButton("QUIT"); CBut = new JButton("CONTROLS"); CBut.addActionListener(new myActionListener()); CBack = new JButton("<< BACK"); CBack.addActionListener(new myActionListener()); Mon = new JButton("ON"); Mon.addActionListener(new myActionListener()); Moff = new JButton("OFF"); Moff.addActionListener(new myActionListener()); R1 = new JButton("1"); R1.addActionListener(new myActionListener()); R3 = new JButton("3"); R3.addActionListener(new myActionListener()); R5 = new JButton("5"); R5.addActionListener(new myActionListener()); red = new JButton(""); red.addActionListener(new myActionListener()); red1 = new JButton(""); red1.addActionListener(new myActionListener()); black = new JButton(""); black.addActionListener(new myActionListener()); black1 = new JButton(""); black1.addActionListener(new myActionListener()); blue = new JButton(""); blue.addActionListener(new myActionListener()); blue1 = new JButton(""); blue1.addActionListener(new myActionListener()); green = new JButton(""); green.addActionListener(new myActionListener()); green1 = new JButton(""); green1.addActionListener(new myActionListener()); orange = new JButton(""); orange.addActionListener(new myActionListener()); orange1 = new JButton(""); orange1.addActionListener(new myActionListener()); Wep1ok = new JButton("Click to select Team 2 Weapon"); Wep1ok.addActionListener(new myActionListener()); //TEXTFIELDS Ctxtentr1 = new JTextField("", 15); Ctxtentr2 = new JTextField("", 15); Ctxtis1 = new JTextField("", 15); Ctxtis2 = new JTextField("", 15); Gvstxt = new JTextField("", 15); Gvstxt.setHorizontalAlignment(JTextField.CENTER); Gvstxt.setEditable(false); Cp1tf = new JTextField("", 15); Cp2tf = new JTextField("", 15); Cp3tf = new JTextField("", 15); Cp4tf = new JTextField("", 15); p1txt = new JTextField("", 15); p2txt = new JTextField("", 15); } public void launchFrame() { front.addWindowListener(new myWindowListener()); front.addKeyListener(new MyKeyListener()); instruction.addKeyListener(new MyKeyListener()); Controls.addKeyListener(new MyKeyListener()); character.addKeyListener(new MyKeyListener()); weapon.addKeyListener(new MyKeyListener()); location.addKeyListener(new MyKeyListener()); option.addKeyListener(new MyKeyListener()); gamescreen.addKeyListener(new MyKeyListener()); Fplay.addActionListener(new myActionListener()); Finstruct.addActionListener(new myActionListener()); Fexit.addActionListener(new myActionListener()); Iback.addActionListener(new myActionListener()); Cok.addActionListener(new myActionListener()); Cok2.addActionListener(new myActionListener()); Ccont.addActionListener(new myActionListener()); Wback.addActionListener(new myActionListener()); Wcont.addActionListener(new myActionListener()); Lback.addActionListener(new myActionListener()); Lcont.addActionListener(new myActionListener()); Oback.addActionListener(new myActionListener()); Obegin.addActionListener(new myActionListener()); resume.addActionListener(new myActionListener()); quit1.addActionListener(new myActionListener()); gamescreen.setResizable(false); gamescreen.setSize(1020, 730); gamescreen.setLocation(0, 0); instruction.setResizable(false); instruction.setSize(1030, 735); instruction.setLocation(0, 0); character.setResizable(false); character.setSize(1030, 735); character.setLocation(0, 0); weapon.setResizable(false); weapon.setSize(1030, 735); weapon.setLocation(0, 0); location.setResizable(false); location.setSize(1030, 735); location.setLocation(0, 0); Controls.setResizable(false); Controls.setSize(1030, 735); Controls.setLocation(0, 0); option.setResizable(false); option.setSize(1030, 735); option.setLocation(0, 0); front.setSize(1030, 735); front.setLocation(0, 0); pause.setResizable(false); pause.setSize(55, 55); pause.setLocation(0, 0); quit.setResizable(false); quit.setSize(55, 55); quit.setLocation(0, 0); gamescreen.getContentPane().add(lev1, BorderLayout.CENTER); gamescreen.getContentPane().add(Gtop, BorderLayout.NORTH); character.getContentPane().add(Ct, BorderLayout.NORTH); character.getContentPane().add(Cm, BorderLayout.CENTER); character.getContentPane().add(Cb, BorderLayout.SOUTH); character.getContentPane().add(Cl, BorderLayout.EAST); character.getContentPane().add(Cr, BorderLayout.WEST); weapon.getContentPane().add(Wt, BorderLayout.NORTH); weapon.getContentPane().add(Wl, BorderLayout.WEST); weapon.getContentPane().add(Wm, BorderLayout.CENTER); weapon.getContentPane().add(Wr, BorderLayout.EAST); weapon.getContentPane().add(Wb, BorderLayout.SOUTH); location.getContentPane().add(Lt, BorderLayout.NORTH); location.getContentPane().add(Lml, BorderLayout.WEST); location.getContentPane().add(Lmm, BorderLayout.CENTER); location.getContentPane().add(Lmr, BorderLayout.EAST); location.getContentPane().add(Lb, BorderLayout.SOUTH); Controls.getContentPane().add(Ctop, BorderLayout.NORTH); Controls.getContentPane().add(Cmiddle, BorderLayout.CENTER); Controls.getContentPane().add(Cbottom, BorderLayout.SOUTH); instruction.getContentPane().add(It, BorderLayout.NORTH); instruction.getContentPane().add(Im, BorderLayout.CENTER); instruction.getContentPane().add(Ib, BorderLayout.SOUTH); option.getContentPane().add(Ot, BorderLayout.NORTH); option.getContentPane().add(Ol, BorderLayout.WEST); option.getContentPane().add(Om, BorderLayout.CENTER); option.getContentPane().add(Or, BorderLayout.EAST); option.getContentPane().add(Ob, BorderLayout.SOUTH); front.getContentPane().add(Ft, BorderLayout.NORTH); front.getContentPane().add(Fm, BorderLayout.CENTER); front.getContentPane().add(Fb, BorderLayout.SOUTH); pause.getContentPane().add(resume, BorderLayout.CENTER); quit.getContentPane().add(quit1, BorderLayout.CENTER); Ft.add(Ftopl); Ft.setBackground(Color.YELLOW); Ft.add(Fpic); Fm.setLayout(new GridLayout(2, 1)); Fm.add(FLab); Fm.add(Fintro); Fm.setBackground(Color.YELLOW); Fb.setLayout(new GridLayout(1, 3)); Fb.add(Fplay); Fplay.setBorderPainted(false); Fplay.setBackground(Color.YELLOW); Fb.add(Finstruct); Finstruct.setBorderPainted(false); Finstruct.setBackground(Color.YELLOW); Fb.add(Fexit); Fexit.setBorderPainted(false); Fexit.setBackground(Color.YELLOW); It.add(Itopl); Im.add(Iobjective); Im.add(Ipic); Ib.setLayout(new GridLayout(1, 2)); Ib.add(Iback); Ib.add(CBut); CBut.setBorderPainted(false); CBut.setBackground(Color.YELLOW); Iback.setBorderPainted(false); Iback.setBackground(Color.YELLOW); It.setBackground(Color.YELLOW); Im.setBackground(Color.YELLOW); Ib.setBackground(Color.YELLOW); Ctop.add(Ctopc); Cmiddle.add(control); Cbottom.add(CBack); CBack.setBorderPainted(false); CBack.setBackground(Color.YELLOW); Ctop.setBackground(Color.YELLOW); Cmiddle.setBackground(Color.YELLOW); Cbottom.setBackground(Color.YELLOW); Ct.add(Ctopl); Ct.setBackground(new Color(15, 102, 208)); Ctopl.setForeground(Color.WHITE); Cr.setLayout(new GridLayout(6, 1)); Cr.add(Cteam1); Cr.add(p1pic); Cr.add(Cname1); Cr.add(p2pic); Cr.add(Ctxtentr1); Cr.add(Cok); Cr.setBackground(Color.BLACK); Cname1.setForeground(Color.WHITE); Cteam1.setForeground(Color.WHITE); Cl.setLayout(new GridLayout(6, 1)); Cl.add(Cteam2); Cl.add(p3pic); Cl.add(Cname2); Cl.add(p4pic); Cl.add(Ctxtentr2); Cl.add(Cok2); Cl.setBackground(Color.BLACK); Cname2.setForeground(Color.WHITE); Cteam2.setForeground(Color.WHITE); Cm.setLayout(new GridLayout(4, 1)); Cm.add(p1); p1.setBackground(Color.BLACK); p1.setBorderPainted(false); Cm.add(p2); p2.setBackground(Color.BLACK); p2.setBorderPainted(false); Cm.add(p3); p3.setBackground(Color.BLACK); p3.setBorderPainted(false); Cm.add(p4); p4.setBackground(Color.BLACK); p4.setBorderPainted(false); Cm.setBackground(Color.BLACK); Cb.add(Ccont); Ccont.setBackground(new Color(15, 102, 208)); Ccont.setBorderPainted(false); Cb.setBackground(new Color(15, 102, 208)); Cb.setForeground(Color.WHITE); Wt.add(Wtopl); Wt.setBackground(new Color(239, 96, 80)); Wl.setLayout(new GridLayout(5, 1)); Wl.add(g1); Wl.add(g2); Wl.add(g3); Wl.add(g4); Wl.add(g5); Wm.setLayout(new GridLayout(8, 1)); Wm.add(wep1); Wm.add(wep1pic); Wm.add(wep2); Wm.add(wep2pic); Wm.add(wep3); Wm.add(wep3pic); Wm.add(wep4); Wm.add(wep4pic); Wr.setLayout(new BoxLayout(Wr, BoxLayout.Y_AXIS)); Wr.add(Box.createRigidArea(new Dimension(0, 120))); Wr.add(Wep1); Wr.add(Box.createRigidArea(new Dimension(0, 90))); Wr.add(Wep2); Wr.add(Box.createRigidArea(new Dimension(0, 120))); Wr.add(Wep1ok); Wr.add(Box.createRigidArea(new Dimension(0, 80))); Wr.add(Wep3); Wr.add(Box.createRigidArea(new Dimension(0, 90))); Wr.add(Wep4); Wb.add(Wback); Wback.setBackground(new Color(239, 96, 80)); Wback.setBorderPainted(false); Wb.setBackground(new Color(239, 96, 80)); Wb.add(Wcont); Wcont.setBackground(new Color(239, 96, 80)); Wcont.setBorderPainted(false); Lml.setLayout(new GridLayout(5, 1)); Lt.add(Ltopl); Lt.setBackground(new Color(68, 94, 215)); Lml.add(stg1); Lml.add(stg2); Lml.add(stg3); Lml.add(stg4); Lml.add(stg5); Lmm.setLayout(new BoxLayout(Lmm, BoxLayout.Y_AXIS)); Lmm.add(Box.createRigidArea(new Dimension(120, 190))); Lmm.add(Loc1p); Lmm.add(Box.createRigidArea(new Dimension(160, 40))); Lmm.add(Loc1); Lb.add(Lback); Lback.setBackground(new Color(68, 94, 215)); Lback.setBorderPainted(false); Lb.setBackground(new Color(68, 94, 215)); Lb.add(Lcont); Lcont.setBackground(new Color(68, 94, 215)); Lcont.setBorderPainted(false); Ot.add(Otopl); Ot.setBackground(new Color(108, 174, 130)); Ol.setLayout(new GridLayout(5, 1)); Ol.add(Omusic); // Ol.add(Oround); Ol.add(Otcol1); Ol.add(Otcol2); Om.setLayout(new GridLayout(5, 1)); Om.add(MusicL); // Om.add(RoundL); Om.add(Color1L); Om.add(Color2L); Or.setLayout(new BoxLayout(Or, BoxLayout.Y_AXIS)); Or.add(Box.createRigidArea(new Dimension(1, 60))); Or.add(Mon, c); Or.add(Box.createRigidArea(new Dimension(1, 10))); Or.add(Moff, c); // Or.add(Box.createRigidArea(new Dimension(1, 60))); // Or.add(R1, c); // Or.add(Box.createRigidArea(new Dimension(1, 5))); // Or.add(R3, c); // Or.add(Box.createRigidArea(new Dimension(1, 5))); // Or.add(R5, c); Or.add(Box.createRigidArea(new Dimension(1, 50))); Or.add(red, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(black, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(blue, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(green, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(orange, c); Or.add(Box.createRigidArea(new Dimension(1, 50))); Or.add(red1, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(black1, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(blue1, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(green1, c); Or.add(Box.createRigidArea(new Dimension(1, 5))); Or.add(orange1, c); Ob.add(Oback); Oback.setBackground(new Color(108, 174, 130)); Oback.setBorderPainted(false); Ob.setBackground(new Color(108, 174, 130)); Ob.add(Obegin); Obegin.setBackground(new Color(108, 174, 130)); Obegin.setBorderPainted(false); Gtop.add(Gvstxt); red.setBackground(Color.RED); black.setBackground(Color.BLACK); blue.setBackground(Color.BLUE); green.setBackground(Color.GREEN); orange.setBackground(Color.ORANGE); red1.setBackground(Color.RED); black1.setBackground(Color.BLACK); blue1.setBackground(Color.BLUE); green1.setBackground(Color.GREEN); orange1.setBackground(Color.ORANGE); front.setVisible(true); } public class MyKeyListener implements KeyListener { public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { for (int i=0; i<1000; i++){ if (manshoot==false){ manshoot=true; gun = new Shoot(x, y, i); gun.start(); break; } } } if (e.getKeyCode() == KeyEvent.VK_NUMPAD0) { for (int i=0; i<1000; i++){ if (manshoot1==false){ manshoot1=true; gun1 = new Shoot1( x1, y1, i); gun1.start(); break; } } } //pause if (e.getKeyCode() == KeyEvent.VK_P) { pause.setVisible(true); } //quit if (e.getKeyCode() == KeyEvent.VK_Q) { quit.setVisible(true); } //player 1 controls if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (x != 970) { x = x + 10; a = 2; // if ((x >= 380) && (y >= 355) && (y <= 480)) { // x = x - 10; // } // if ((x <= 40)&&(y>=100)&&(y<=150)){ // x = x - 10; // } gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (x != 0) { x = x - 10; a = 2; // if ((x <= 520) && (y >= 355) && (y <= 480)) { // x = x + 10; // } gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_UP) { if (y != -10) { y = y - 10; a = 2; // if ((x <= 452) && (y >= 452) && (y <= 348)) { // x = x - 10; // } gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (y != 630) { y = y + 10; a = 2; // if ((x <= 452) && (y >= 348) && (y <= 452)) { // x = x - 10; // } gamescreen.repaint(); } } //player 2 controls if (e.getKeyCode() == KeyEvent.VK_D) { if (x1 != 970) { x1 = x1 + 10; b = 3; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_A) { if (x1 != 0) { x1 = x1 - 10; b = 3; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_W) { if (y1 != -10) { y1 = y1 - 10; b = 3; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_S) { if (y1 != 630) { y1 = y1 + 10; b = 3; gamescreen.repaint(); } } //player 3 controls if (e.getKeyCode() == KeyEvent.VK_K) { if (x2 != 970) { x2 = x2 + 10; cc = 4; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_H) { if (x2 != 0) { x2 = x2 - 10; cc = 2; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_U) { if (y2 != -10) { y2 = y2 - 10; cc = 3; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_J) { if (y2 != 630) { y2 = y2 + 10; cc = 1; gamescreen.repaint(); } } // PLAYER 4 CONTROLS if (e.getKeyCode() == KeyEvent.VK_NUMPAD6) { if (x3 != 930) { x3 = x3 + 10; d = 3; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_NUMPAD4) { if (x3 != 0) { x3 = x3 - 10; d = 2; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_NUMPAD8) { if (y3 != -10) { y3 = y3 - 10; d = 4; gamescreen.repaint(); } } if (e.getKeyCode() == KeyEvent.VK_NUMPAD5) { if (y3 != 600) { y3 = y3 + 10; d = 1; gamescreen.repaint(); } } } } class myActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { team1 = Ctxtentr1.getText(); if (team1 == null || team1.equals("")) { team1 = "TEAM 1"; } team2 = Ctxtentr2.getText(); if (team2 == null || team2.equals("")) { team2 = "TEAM 2"; } if (team.compareToIgnoreCase(team1) == 0) { if (e.getSource() == p1) { if (imagepic) { p2pic.setIcon(new ImageIcon("alex1.png")); PlaceHolders[2]=Toolkit.getDefaultToolkit().getImage("alex1.png"); Cteam1.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr1.setEditable(true); Ctxtentr1.requestFocus(); wep2.setText("TEAM 1 - 'The Mean Machine' Select weapon"); team = ""; } else { p1pic.setIcon(new ImageIcon("alex1.png")); PlaceHolders[1]=Toolkit.getDefaultToolkit().getImage("alex1.png"); gamescreen.repaint(); Cteam1.setText("SELECT SECOND PLAYER"); imagepic = true; wep1.setText("TEAM 1 - 'The Mean Machine' Select weapon"); } } if (e.getSource() == p2) { if (imagepic) { p2pic.setIcon(new ImageIcon("timmy1.png")); Cteam1.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr1.setEditable(true); Ctxtentr1.requestFocus(); wep2.setText("TEAM 1 - 'The Dominator' Select weapon"); team = ""; } else { p1pic.setIcon(new ImageIcon("timmy1.png")); Cteam1.setText("SELECT SECOND PLAYER"); imagepic = true; wep1.setText("TEAM 1 - 'The Dominator' Select weapon"); } } if (e.getSource() == p3) { if (imagepic) { p2pic.setIcon(new ImageIcon("ben1.png")); Cteam1.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr1.setEditable(true); Ctxtentr1.requestFocus(); wep2.setText("TEAM 1 - 'The Terminator' Select weapon"); team = ""; } else { p1pic.setIcon(new ImageIcon("ben1.png")); Cteam1.setText("SELECT SECOND PLAYER"); imagepic = true; wep1.setText("TEAM 1 - 'The Terminator' Select weapon"); } } if (e.getSource() == p4) { if (imagepic) { p2pic.setIcon(new ImageIcon("pye1.png")); Cteam1.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr1.setEditable(true); Ctxtentr1.requestFocus(); wep2.setText("TEAM 1 - 'Mr Incredible' Select weapon"); team = ""; } else { p1pic.setIcon(new ImageIcon("pye1.png")); Cteam1.setText("SELECT SECOND PLAYER"); imagepic = true; wep1.setText("TEAM 1 - 'Mr Incredible' Select weapon"); } } } if (e.getSource() == Cok) { Cname1.setText(team1); Cteam1.setText(""); Cteam2.setText("TEAM 2, SELECT FIRST PLAYER"); team = team2; } if (team.compareToIgnoreCase(team2) == 0) { if (e.getSource() == p1) { if (imagepic2) { p4pic.setIcon(new ImageIcon("alex1.png")); Cteam2.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr2.setEditable(true); Ctxtentr2.requestFocus(); wep4.setText("TEAM 2 - 'The Mean Machine' Select weapon"); team = ""; } else { p3pic.setIcon(new ImageIcon("alex1.png")); Cteam2.setText("SELECT SECOND PLAYER"); imagepic2 = true; wep3.setText("TEAM 2 - 'The Mean Machine' Select weapon"); } } if (e.getSource() == p2) { if (imagepic2) { p4pic.setIcon(new ImageIcon("timmy1.png")); Cteam2.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr2.setEditable(true); Ctxtentr2.requestFocus(); wep4.setText("TEAM 2 - 'The Dominator' Select weapon"); team = ""; } else { p3pic.setIcon(new ImageIcon("timmy1.png")); Cteam2.setText("SELECT SECOND PLAYER"); imagepic2 = true; wep3.setText("TEAM 2 - 'The Dominator' Select weapon"); } } if (e.getSource() == p3) { if (imagepic2) { p4pic.setIcon(new ImageIcon("ben1.png")); Cteam2.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr2.setEditable(true); Ctxtentr2.requestFocus(); wep4.setText("TEAM 2 - 'The Terminator' Select weapon"); team = ""; } else { p3pic.setIcon(new ImageIcon("ben1.png")); Cteam2.setText("SELECT SECOND PLAYER"); imagepic2 = true; wep3.setText("TEAM 2 - 'The Terminator' Select weapon"); } } if (e.getSource() == p4) { if (imagepic2) { p4pic.setIcon(new ImageIcon("pye1.png")); Cteam2.setText("ENTER TEAM NAME THEN CLICK OK"); Ctxtentr2.setEditable(true); Ctxtentr2.requestFocus(); wep4.setText("TEAM 2 - 'Mr Incredible' Select weapon"); team = ""; } else { p3pic.setIcon(new ImageIcon("pye1.png")); Cteam2.setText("SELECT SECOND PLAYER"); imagepic2 = true; wep3.setText("TEAM 2 - 'Mr Incredible' Select weapon"); } } } if (e.getSource() == Cok2) { Cname2.setText(team2); Cteam2.setText(""); team=team1; } if (team.compareToIgnoreCase(team1)==0){ if (e.getSource() == g1) { if (goWpn) { wep2pic.setIcon(new ImageIcon("bullet1.png")); Wep2.setText("Pistol"); team=""; } else { wep1pic.setIcon(new ImageIcon("bullet1.png")); Wep1.setText("Pistol"); wep2.setVisible(true); goWpn = true; } } if (e.getSource() == g2) { if (goWpn) { wep2pic.setIcon(new ImageIcon("bullet3.png")); Wep2.setText("Machine Gun"); team=""; } else { wep1pic.setIcon(new ImageIcon("bullet3.png")); Wep1.setText("Machine Gun"); wep2.setVisible(true); goWpn = true; } } if (e.getSource() == g3) { if (goWpn) { wep2pic.setIcon(new ImageIcon("bullet2.png")); Wep2.setText("Rifle"); team=""; } else { wep1pic.setIcon(new ImageIcon("bullet2.png")); Wep1.setText("Rifle"); wep2.setVisible(true); goWpn = true; } } if (e.getSource() == g4) { if (goWpn) { wep2pic.setIcon(new ImageIcon("bullet5.png")); Wep2.setText("Shotgun"); team=""; } else { wep1pic.setIcon(new ImageIcon("bullet5.png")); Wep1.setText("Shotgun"); wep2.setVisible(true); goWpn = true; } } if (e.getSource() == g5) { if (goWpn) { wep2pic.setIcon(new ImageIcon("bullet4.png")); Wep2.setText("Uzi"); team=""; } else { wep1pic.setIcon(new ImageIcon("bullet4.png")); Wep1.setText("Uzi"); wep2.setVisible(true); goWpn = true; } } } if (e.getSource() == Wep1ok) { wep3.setVisible(true); team=team2; } if (team.compareToIgnoreCase(team2)==0){ if (e.getSource() == g1) { if (goWpn2) { wep4pic.setIcon(new ImageIcon("bullet1.png")); Wep4.setText("Pistol"); team=""; } else { wep3pic.setIcon(new ImageIcon("bullet1.png")); Wep3.setText("Pistol"); wep4.setVisible(true); goWpn2 = true; } } if (e.getSource() == g2) { if (goWpn2) { wep4pic.setIcon(new ImageIcon("bullet3.png")); Wep4.setText("Machine Gun"); team=""; } else { wep3pic.setIcon(new ImageIcon("bullet3.png")); Wep3.setText("Machine Gun"); wep4.setVisible(true); goWpn2 = true; } } if (e.getSource() == g3) { if (goWpn2) { wep4pic.setIcon(new ImageIcon("bullet2.png")); Wep4.setText("Rifle"); team=""; } else { wep3pic.setIcon(new ImageIcon("bullet2.png")); Wep3.setText("Rifle"); wep4.setVisible(true); goWpn2 = true; } } if (e.getSource() == g4) { if (goWpn2) { wep4pic.setIcon(new ImageIcon("bullet5.png")); Wep4.setText("Shotgun"); team=""; } else { wep3pic.setIcon(new ImageIcon("bullet5.png")); Wep3.setText("Shotgun"); wep4.setVisible(true); goWpn2 = true; } } if (e.getSource() == g5) { if (goWpn2) { wep4pic.setIcon(new ImageIcon("bullet4.png")); Wep4.setText("Uzi"); team=""; } else { wep3pic.setIcon(new ImageIcon("bullet4.png")); Wep3.setText("Uzi"); wep4.setVisible(true); goWpn2 = true; } } } if (e.getSource() == Wep1ok) { Wep3.requestFocus(); } if (e.getSource() == Wep1ok) { Wep3.requestFocus(); } if (e.getSource() == p1) { PlaceHolders[1] = alex[1]; gamescreen.repaint(); } if (e.getSource() == p1) { PlaceHolders[1] = timmy[1]; gamescreen.repaint(); } if (e.getSource() == p1) { PlaceHolders[1] = ben[1]; gamescreen.repaint(); } if (e.getSource() == p1) { PlaceHolders[1] = pye[1]; gamescreen.repaint(); } if (e.getSource() == stg1) { Loc1p.setIcon(new ImageIcon("space.jpg")); Loc1p.requestFocus(); Loc1.setIcon(new ImageIcon("Spacewriting.jpg")); lev1.repaint(); } if (e.getSource() == stg2) { Loc1p.setIcon(new ImageIcon("desert.jpg")); Loc1p.requestFocus(); Loc1.setIcon(new ImageIcon("Desertwriting.jpg")); backgroundImage1 = backgroundImage2; gamescreen.getContentPane().add(lev2, BorderLayout.CENTER); lev2.repaint(); } if (e.getSource() == stg3) { Loc1p.setIcon(new ImageIcon("ocean.jpg")); Loc1p.requestFocus(); Loc1.setIcon(new ImageIcon("Oceanwriting.jpg")); backgroundImage1 = backgroundImage3; gamescreen.getContentPane().add(lev3, BorderLayout.CENTER); lev3.repaint(); } if (e.getSource() == stg4) { Loc1p.setIcon(new ImageIcon("fire.jpg")); Loc1p.requestFocus(); Loc1.setIcon(new ImageIcon("Firewriting.jpg")); backgroundImage1 = backgroundImage4; gamescreen.getContentPane().add(lev4, BorderLayout.CENTER); lev4.repaint(); } if (e.getSource() == stg5) { Loc1p.setIcon(new ImageIcon("woods.jpg")); Loc1p.requestFocus(); Loc1.setIcon(new ImageIcon("Woodswriting.jpg")); backgroundImage1 = backgroundImage5; gamescreen.getContentPane().add(lev5, BorderLayout.CENTER); lev5.repaint(); } if (e.getSource() == Obegin) { Gvstxt.setText(Ctxtentr1.getText() + " VS " + Ctxtentr2.getText()); } if (e.getSource() == resume) { pause.setVisible(false); } if (e.getSource() == quit1) { front.setVisible(true); instruction.setVisible(false); Controls.setVisible(false); character.setVisible(false); weapon.setVisible(false); location.setVisible(false); option.setVisible(false); gamescreen.setVisible(false); quit.hide(); } if (e.getSource() == Fplay) { character.setVisible(true); front.setVisible(false); character.requestFocus(); team=team1; } if (e.getSource() == Finstruct) { instruction.setVisible(true); front.setVisible(false); instruction.requestFocus(); } if (e.getSource() == Fexit) { System.exit(0); } if (e.getSource() == Iback) { front.setVisible(true); instruction.hide(); front.requestFocus(); } if (e.getSource() == CBut) { Controls.setVisible(true); instruction.hide(); Controls.requestFocus(); } if (e.getSource() == CBack) { instruction.setVisible(true); Controls.hide(); instruction.requestFocus(); } if (e.getSource() == Ccont) { weapon.setVisible(true); character.hide(); weapon.requestFocus(); } if (e.getSource() == Wback) { character.setVisible(true); weapon.hide(); character.requestFocus(); } if (e.getSource() == Wcont) { location.setVisible(true); weapon.hide(); location.requestFocus(); } if (e.getSource() == Lback) { weapon.setVisible(true); location.hide(); weapon.requestFocus(); } if (e.getSource() == Lcont) { option.setVisible(true); location.hide(); option.requestFocus(); } if (e.getSource() == Oback) { location.setVisible(true); option.hide(); location.requestFocus(); } if (e.getSource() == Mon) { MusicL.setText("ON"); } if (e.getSource() == Moff) { MusicL.setText("OFF"); } // if (e.getSource() == R1) { // RoundL.setText("1 round"); // } // if (e.getSource() == R3) { // RoundL.setText("3 rounds"); // } // if (e.getSource() == R5) { // RoundL.setText("5 rounds"); // } if (e.getSource() == red) { Color1L.setIcon(new ImageIcon("base1red.png")); base1[b1] = base1[0]; gamescreen.repaint(); } if (e.getSource() == red1) { Color2L.setIcon(new ImageIcon("base2red.png")); base2[b2] = base2[0]; gamescreen.repaint(); } if (e.getSource() == black) { Color1L.setIcon(new ImageIcon("base2black.png")); base1[b1] = base1[1]; gamescreen.repaint(); } if (e.getSource() == black1) { Color2L.setIcon(new ImageIcon("base2black.png")); base2[b2] = base2[1]; gamescreen.repaint(); } if (e.getSource() == blue) { Color1L.setIcon(new ImageIcon("base1blue.png")); base1[b1] = base1[2]; gamescreen.repaint(); } if (e.getSource() == blue1) { Color2L.setIcon(new ImageIcon("base2blue.png")); base2[b2] = base2[2]; gamescreen.repaint(); } if (e.getSource() == green) { Color1L.setIcon(new ImageIcon("base1green.png")); base1[b1] = base1[3]; gamescreen.repaint(); } if (e.getSource() == green1) { Color2L.setIcon(new ImageIcon("base2green.png")); base2[b2] = base2[3]; gamescreen.repaint(); } if (e.getSource() == orange) { Color1L.setIcon(new ImageIcon("base1orange.png")); base1[b1] = base1[4]; gamescreen.repaint(); } if (e.getSource() == orange1) { Color2L.setIcon(new ImageIcon("base2orange.png")); base2[b2] = base2[4]; gamescreen.repaint(); } if (e.getSource() == Obegin) { gamescreen.setVisible(true); gamescreen.repaint(); option.hide(); gamescreen.requestFocus(); } } } public class Shoot extends Thread{ int gun_x = 0; int gun_y = 0; int bullet_xy = 0; public Shoot(int start1, int start2, int start3){ gun_x = start1; gun_y = start2; bullet_xy = start3; } public void run(){ do{ gun_x=gun_x+50; // + = direction left, right; 50(number) means how fast its going gamescreen.repaint(); if (((gun_x>=x3)&&((gun_x+15)<=(x3+90)))&&((gun_y>=y3)&&((gun_y+5)<=(y3+110)))){ System.out.println("Working"); die=true; } try{this.sleep(50);}catch(InterruptedException e){} }while ((gun_y>100)&&(hitman!=true)); manshoot[bullet_xy] = false; } } public class Shoot1 extends Thread{ int gun_x1 = 0; int gun_y1 = 0; int bullet_xy = 0; public Shoot1(int start4, int start5, int start6){ gun_x1 = start4; gun_y1 = start5; bullet_xy = start6; } public void run(){ do{ gun_x1=gun_x1-15; gamescreen.repaint(); if (((gun_x1>=x2)&&((gun_x1+15)<=(x2+90)))&&((gun_y1>=y2)&&((gun_y1+5)<=(y2+110)))){ System.out.println("Working"); die=true; } try{this.sleep(50);}catch(InterruptedException e){} }while ((gun_y1>100)&&(hitman!=true)); manshoot1[bullet_xy] = false; } } public void main(){ } class myWindowListener implements WindowListener { public void windowClosing(WindowEvent w) { System.exit(0); } public void windowOpened(WindowEvent w) { } public void windowIconified(WindowEvent w) { } public void windowDeiconified(WindowEvent w) { } public void windowDeactivated(WindowEvent w) { } public void windowClosed(WindowEvent w) { } public void windowActivated(WindowEvent w) { } } public static void main(String[] args) { Tag_eg Taga1 = new Tag_eg(); Taga1.launchFrame(); } } thanks in advance; ALSO.... how would i go about doing this; i have a base(picture) on each side on the gamescreen and i want to put a pic of a flag in the middle.(that part i can do), but i want to be able to make it so when a player walks over that image of the flag, the flag will be attached to him and something will say "you win!!!" (i'm doing a capture the flag type game if you haven't already guessed) thanks again in advance- PLS HELP