private void createMenuChildScene() {

    menuChildScene = new MenuScene(camera);
    menuChildScene.setPosition(0, 0);

    // SpriteMenuItem smi = new Sp

    final IMenuItem playMenuItem =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(MENU_PLAY, resourcesManager.play_region, vbom), 1.3f, 1f);
    final IMenuItem optionsMenuItem =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(MENU_OPTIONS, resourcesManager.options_region, vbom), 1.3f, 1f);
    final IMenuItem levelSelectorMenuItem =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(MENU_LEVEL_SELECTOR, resourcesManager.simulation_region, vbom),
            1.3f,
            1f);

    menuChildScene.addMenuItem(playMenuItem);
    menuChildScene.addMenuItem(levelSelectorMenuItem);
    menuChildScene.addMenuItem(optionsMenuItem);

    menuChildScene.buildAnimations();
    menuChildScene.setBackgroundEnabled(false);

    playMenuItem.setPosition(playMenuItem.getX() - 130, playMenuItem.getY() - 200);
    optionsMenuItem.setPosition(optionsMenuItem.getX(), optionsMenuItem.getY() - 170);
    levelSelectorMenuItem.setPosition(
        levelSelectorMenuItem.getX() + 125, levelSelectorMenuItem.getY() - 145);

    menuChildScene.setOnMenuItemClickListener(this);

    setChildScene(menuChildScene);
  }
  private void createMenuChildScene() {
    submenuChildScene = new MenuScene(camera);
    submenuChildScene.setPosition(WIDTH, HEIGHT);

    final IMenuItem optionsMenuItem =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(MENU_OPTIONS, resourcesManager.submenu_item1_region, vbom), 1.2f, 1);
    // final IMenuItem quitMenuItem = new ScaleMenuItemDecorator(new
    // SpriteMenuItem(MENU_QUIT,resourcesManager.quit_region,vbom),1.2f,1);

    submenuChildScene.addMenuItem(optionsMenuItem);

    submenuChildScene.buildAnimations(); // must setposition after it unless it has no effect
    submenuChildScene.setBackgroundEnabled(false);

    //		playMenuItem.setPosition(playMenuItem.getX()-20, playMenuItem.getY() - 150);
    //		optionsMenuItem.setPosition(optionsMenuItem.getX()-20, optionsMenuItem.getY() - 110);

    optionsMenuItem.setPosition(
        (WIDTH / 2 - optionsMenuItem.getWidth() / 2) - 50,
        (HEIGHT / 2 - optionsMenuItem.getHeight() / 2) - 50);

    submenuChildScene.setOnMenuItemClickListener(this);

    setChildScene(submenuChildScene);
  }
Esempio n. 3
0
  private void agregaMenu() {
    menu = new MenuScene(actividadJuego.camara);
    // Centrado en la pantalla
    menu.setPosition(ControlJuego.ANCHO_CAMARA / 2, ControlJuego.ALTO_CAMARA / 2);

    IMenuItem opcionContinue =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(
                OPCION_CONTINUE, regionBtnContinue, actividadJuego.getVertexBufferObjectManager()),
            1.5f,
            1);
    menu.addMenuItem(opcionContinue);
    levelUp =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(
                OPCION_LEVELUP, regionLevelUp, actividadJuego.getVertexBufferObjectManager()),
            1,
            1);
    menu.addMenuItem(levelUp);
    levelUp.setVisible(false);

    if (didILevelUp == true) {
      levelUp.setVisible(true);
    }

    menu.buildAnimations();
    menu.setBackgroundEnabled(false);
    opcionContinue.setPosition(450, -240);
    levelUp.setPosition(450, -110);

    menu.setOnMenuItemClickListener(
        new MenuScene.IOnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClicked(
              MenuScene pMenuScene,
              IMenuItem pMenuItem,
              float pMenuItemLocalX,
              float pMenuItemLocalY) {
            // El parámetro pMenuItem indica la opción oprimida
            switch (pMenuItem.getID()) {
              case OPCION_CONTINUE:
                if (playerwin == true) {
                  admEscenas.crearEscenaBatalla2();
                  admEscenas.setEscena(TipoEscena.ESCENA_BATALLA2);
                  admEscenas.liberarEscenaFinBatalla();
                } else if (playerwin == false) {
                  admEscenas.crearEscenaBatalla();
                  admEscenas.setEscena(TipoEscena.ESCENA_BATALLA);
                  admEscenas.liberarEscenaFinBatalla();
                }
                break;
            }
            return true;
          }
        });
    setChildScene(menu);
  }
Esempio n. 4
0
  private void createMenuChildScene() {
    menuChildScene = new org.andengine.entity.scene.menu.MenuScene(camera);
    menuChildScene.setPosition(0, 0);

    final IMenuItem playMenuItem =
        new ScaleMenuItemDecorator(new SpriteMenuItem(MENU_PLAY, play_region, vbom), 1.2f, 1);
    final IMenuItem optionsMenuItem =
        new ScaleMenuItemDecorator(new SpriteMenuItem(MENU_OPTIONS, options_region, vbom), 1.2f, 1);

    menuChildScene.addMenuItem(playMenuItem);
    menuChildScene.addMenuItem(optionsMenuItem);

    menuChildScene.buildAnimations();
    menuChildScene.setBackgroundEnabled(false);

    playMenuItem.setPosition(playMenuItem.getX(), playMenuItem.getY());
    optionsMenuItem.setPosition(optionsMenuItem.getX(), optionsMenuItem.getY());

    menuChildScene.setOnMenuItemClickListener(
        new IOnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClicked(
              org.andengine.entity.scene.menu.MenuScene pMenuScene,
              IMenuItem pMenuItem,
              float pMenuItemLocalX,
              float pMenuItemLocalY) {
            switch (pMenuItem.getID()) {
              case MENU_PLAY:
                sceneManager.loadGameScene();
                sceneManager.createGameScene();
                sceneManager.goToGameScene();
                return true;
              case MENU_OPTIONS:
                return true;
              default:
                return false;
            }
          }
        });

    setChildScene(menuChildScene);
  }