Пример #1
0
  public Facebuttons(Everybodyloveskimchi g, String n) {
    this.game = g;
    this.assignedname = n;
    texture = new Texture(Gdx.files.internal("faceicons/" + n + ".png"));
    this.renderer = new SkeletonRenderer();
    renderer.setPremultipliedAlpha(true);
    this.atlas = new TextureAtlas(Gdx.files.internal("foodx.atlas"));
    SkeletonJson json = new SkeletonJson((TextureAtlas) atlas);
    json.setScale(0.7f);
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("foodx.json"));
    skeleton = new Skeleton(skeletonData);
    skeleton.setPosition(0, 0);
    skeleton.getRootBone().setScale(0.6f);
    AnimationStateData stateData = new AnimationStateData(skeletonData);
    state = new AnimationState(stateData);
    state.setTimeScale(0.5f);
    state.setAnimation(0, "idle", false);

    setAg();

    this.setBounds(0, 0, 98f, 106f);

    this.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (enabled) {
              System.out.println(assignedname + "down");
              clickedY = -5f;
              game.members.get(assignedname).foodtoeat = game.currentFood;
              game.sendMemeber(assignedname);
              //          clickedY
              //            moveTo(0f,100f,10);
              //
            }
            return true;
          }

          @Override
          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            if (enabled) {
              System.out.println(assignedname + "up");
              clickedY = 0f;
              //            trip();
            }
          }
        });
  }