Esempio n. 1
0
  public void update() {
    System.out.println("asdsadsdasaddsasda " + handler.countOfObject(ID.BasicEnemy));

    r = new Random();
    road.update();
    handler.tick();
    if (System.currentTimeMillis() - timer > 5000) {

      // System.out.println("asdasdasdasd" + );
      if (enemyCounter < 4) {
        handler.addObject(
            new BasicEnemy(this, enemy, r.nextInt(getWidth() - 100), -450, ID.BasicEnemy, handler));
        // handler.addObject(new BasicEnemy(this, enemy2, r.nextInt(getWidth() -100), -450,
        // ID.BasicEnemy, handler));

        enemyCounter++;
        this.road.setMy(road.getMy() + 1);
      }

      timer += 5000;
    }
    if (System.currentTimeMillis() - timer2 > 10000) {
      try {
        //  gameThread.setRunning(false);
        this.road.setMy(road.getMy() - 1);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    //            //System.out.println("asdasdasdasd" + );
    //            if(enemyCounter <10){
    //                handler.addObject(new BasicEnemy(this, enemy, r.nextInt(getWidth() -100),
    // -450, ID.BasicEnemy, handler));
    //                // handler.addObject(new BasicEnemy(this, enemy2, r.nextInt(getWidth() -100),
    // -450, ID.BasicEnemy, handler));
    //
    //
    //                enemyCounter++;
    //                this.road.setMy(road.getMy()+2);
    //            }
    //
    //            timer+= 5000;
    //        }
  }