public void mouseReleased(MouseEvent evt) { if (!neu && !wiedergeben && !verloren && !intro) { if (evt.getSource() == rot) { rot.setIcon(new ImageIcon("files/Minigames/Senso/red_0.png")); if (klick == runde) { wiedergeben = true; neu = false; points++; punkte.setText("Score: " + String.valueOf(points)); punkte.updateUI(); } } if (evt.getSource() == gruen) { gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_0.png")); if (klick == runde) { wiedergeben = true; neu = false; points++; punkte.setText("Score: " + String.valueOf(points)); punkte.updateUI(); } } if (evt.getSource() == blau) { blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_0.png")); if (klick == runde) { wiedergeben = true; neu = false; points++; punkte.setText("Score: " + String.valueOf(points)); punkte.updateUI(); } } if (evt.getSource() == gelb) { gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_0.png")); if (klick == runde) { wiedergeben = true; neu = false; points++; punkte.setText("Score: " + String.valueOf(points)); punkte.updateUI(); } } } }
private void neustarten(boolean intro) { farben = new int[1]; durchgang = 0; runde = 0; klick = 0; points = 0; wait = 250; vKlicks = 0; wiedergeben = false; verloren = false; this.intro = intro; abspielen = false; lblVerloren.setText(""); klicks.setText(""); klicks.updateUI(); neustart.setForeground(Color.darkGray); }
private void verloren() { if (!abspielen) { soundAbspielen(soundF); abspielen = true; neustart.setForeground(Color.gray); leuchten = false; klicks.setText(""); klicks.updateUI(); points = 0; } lblVerloren.setText("Sie haben leider verloren!"); switch (farben[klick]) { case 1: leuchten(rot, "files/Minigames/Senso/red"); gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_n.png")); blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_n.png")); gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_n.png")); break; case 2: rot.setIcon(new ImageIcon("files/Minigames/Senso/red_n.png")); leuchten(gruen, "files/Minigames/Senso/green"); blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_n.png")); gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_n.png")); break; case 3: rot.setIcon(new ImageIcon("files/Minigames/Senso/red_n.png")); gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_n.png")); leuchten(blau, "files/Minigames/Senso/blue"); gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_n.png")); break; case 4: rot.setIcon(new ImageIcon("files/Minigames/Senso/red_n.png")); gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_n.png")); blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_n.png")); leuchten(gelb, "files/Minigames/Senso/yellow"); break; } }