Exemple #1
0
  public void transitionTo(GameObject o) {
    nextRoot = o;
    Input.getInstance().setEnabled(false);

    FadeToAction fadeDown =
        new FadeToAction(
            this,
            1.0,
            FADE_TIME,
            new Observer() {

              public void notified(Observable sender) {

                setRoot(nextRoot);

                FadeToAction fadeUp = new FadeToAction(Game.this, 0, FADE_TIME, null);
                rootObject.addChild(fadeUp);
                fadeUp.start();

                Input.getInstance().setEnabled(true);
              }
            });

    rootObject.addChild(fadeDown);
    fadeDown.start();
  }
Exemple #2
0
  public void paint(Graphics g) {
    g.setColor(Color.black);
    g.fillRect(0, 0, Game.WIDTH, Game.HEIGHT);
    rootObject.drawSelfAndChildren(g);

    // fade
    g.setColor(new Color(0f, 0f, 0f, (float) fade));
    g.fillRect(0, 0, Game.WIDTH, Game.HEIGHT);
  }
Exemple #3
0
  private void setRoot(GameObject o) {
    if (rootObject != null) {
      rootObject.destroy();
    }

    if (DEBUG) {
      Input.getInstance().printNumButtons();
    }

    rootObject = o;
  }
Exemple #4
0
 public void update() {
   Input.getInstance().update();
   rootObject.updateSelfAndChildren();
 }
 public void draw(Graphics2D g2) {
   if (!isDead) super.draw(g2);
   else g2.drawImage(imgExplosion.getImage(), getX(), getY(), null);
 }