Esempio n. 1
0
 private void neueFarbe() {
   try {
     if ((runde % 2) == 0 && wait > 25) {
       wait = wait - 25;
     }
     klick = 0;
     durchgang++;
     zahl = zufall.nextInt(4);
     switch (zahl) {
       case (0):
         rot.setIcon(new ImageIcon("files/Minigames/Senso/red_1.png"));
         soundAbspielen(soundR);
         einfuegen(runde, 1);
         Thread.sleep(wait + 25);
         rot.setIcon(new ImageIcon("files/Minigames/Senso/red_0.png"));
         break;
       case (1):
         gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_1.png"));
         soundAbspielen(soundG);
         einfuegen(runde, 2);
         Thread.sleep(wait + 25);
         gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_0.png"));
         break;
       case (2):
         blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_1.png"));
         soundAbspielen(soundB);
         einfuegen(runde, 3);
         Thread.sleep(wait + 25);
         blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_0.png"));
         break;
       case (3):
         gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_1.png"));
         soundAbspielen(soundY);
         einfuegen(runde, 4);
         Thread.sleep(wait + 25);
         gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_0.png"));
         break;
     }
     durchgang = 0;
     runde++;
     neu = false;
     kopieren();
   } catch (Exception ex) {
   }
 }
Esempio n. 2
0
  public Senso() {
    super("Senso");
    this.setSize(640, 480);
    this.setLocation(100, 100);
    this.getContentPane().setBackground(Color.black);
    this.setUndecorated(true);
    this.setBackground(Color.white);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setResizable(false);
    this.setLayout(null);
    this.setAlwaysOnTop(true);

    klicks = new JLabel();
    klicks.setSize(150, 25);
    klicks.setLocation(20, 300);
    klicks.setFont(new Font("Impact", 5, 25));
    klicks.setForeground(Color.lightGray);
    this.add(klicks);

    start = new JLabel();
    start.setSize(350, 50);
    start.setLocation(350, 200);
    start.setFont(new Font("Impact", 5, 50));
    start.setForeground(Color.lightGray);
    this.add(start);

    lblVerloren = new JLabel();
    lblVerloren.setSize(350, 30);
    lblVerloren.setLocation(200, 215);
    lblVerloren.setFont(new Font("Impact", 5, 30));
    lblVerloren.setForeground(Color.lightGray);
    this.add(lblVerloren);

    neustart = new JLabel("Neustart");
    neustart.setSize(100, 30);
    neustart.setLocation(20, 200);
    neustart.setFont(new Font("Impact", 5, 25));
    neustart.setForeground(Color.darkGray);
    neustart.addMouseListener(this);
    this.add(neustart);

    beenden = new JLabel("Beenden");
    beenden.setSize(100, 30);
    beenden.setLocation(20, 390);
    beenden.setFont(new Font("Impact", 5, 25));
    beenden.setForeground(Color.gray);
    beenden.addMouseListener(this);
    this.add(beenden);

    us = new JLabel("Senso");
    us.setSize(150, 35);
    us.setLocation(10, 30);
    us.setFont(new Font("Impact", 1, 35));
    us.setForeground(Color.white);
    this.add(us);

    punkte = new JLabel("Score: " + String.valueOf(points));
    punkte.setSize(200, 20);
    punkte.setLocation(400, 400);
    punkte.setFont(new Font("Impact", 0, 20));
    punkte.setForeground(Color.white);
    this.add(punkte);

    rot = new JLabel(new ImageIcon("files/Minigames/Senso/red_0.png"));
    rot.setSize(216, 207);
    rot.setLocation(150, 25);
    rot.setBackground(Color.darkGray);
    rot.addMouseListener(this);
    this.add(rot);

    gruen = new JLabel(new ImageIcon("files/Minigames/Senso/green_0.png"));
    gruen.setSize(216, 207);
    gruen.setLocation(366, 25);
    gruen.setBackground(Color.darkGray);
    gruen.addMouseListener(this);
    this.add(gruen);

    gelb = new JLabel(new ImageIcon("files/Minigames/Senso/yellow_0.png"));
    gelb.setSize(216, 207);
    gelb.setLocation(366, 232);
    gelb.setBackground(Color.darkGray);
    gelb.addMouseListener(this);
    this.add(gelb);

    blau = new JLabel(new ImageIcon("files/Minigames/Senso/blue_0.png"));
    blau.setSize(216, 207);
    blau.setLocation(150, 232);
    blau.setBackground(Color.darkGray);
    blau.addMouseListener(this);
    this.add(blau);

    this.addMouseListener(this);

    // spiel = new Thread(this);
    zufall = new Random();

    läuft = false;

    zahl = zufall.nextInt(4);
    // this.setVisible(true);
    soundR = new File("files/Minigames/Senso/rot.wav");
    soundG = new File("files/Minigames/Senso/gruen.wav");
    soundB = new File("files/Minigames/Senso/blau.wav");
    soundY = new File("files/Minigames/Senso/gelb.wav");
    soundF = new File("files/Minigames/Senso/falsch.wav");
  }