Esempio n. 1
0
  private void addBulles(int value, int c, int r) {
    final float x = plateComponent.getX() + PLATE_MARGIN_WIDTH;
    final float y = plateComponent.getY() + PLATE_MARGIN_HEIGHT;
    final float w = (plateComponent.getWidth() - PLATE_MARGIN_WIDTH * 2) / matrix.getWidth();
    final float h = (plateComponent.getHeight() - PLATE_MARGIN_HEIGHT * 2) / matrix.getHeight();

    final BulleComponent bulle =
        new BulleComponent(
            value,
            c,
            r,
            x + c * w,
            y + r * h,
            textureRegion,
            GameActivity.this,
            GameActivity.this,
            darkFont,
            lightFont,
            animated);

    bulle.setSize(w, h);
    bulle.setAlpha(0.0f);
    if (animated) bulle.registerEntityModifier(new FadeInModifier(0.25f));
    else bulle.registerEntityModifier(new FadeInModifier(0.50f));

    getEngine().getScene().attachChild(bulle);
    getEngine().getScene().registerTouchArea(bulle);
  }
Esempio n. 2
0
  private void initPlate() {
    final int[] square = ScreenUtils.getSquare();

    final float x = ScreenUtils.getCenterX() - square[0] / 2 + GAME_MARGIN_WIDTH;
    final float y = ScreenUtils.getCenterY() - square[1] / 2 + GAME_MARGIN_HEIGHT;
    final float w = square[0] - GAME_MARGIN_WIDTH * 2;
    final float h = square[1] - GAME_MARGIN_HEIGHT * 2;

    plateComponent =
        new PlateComponent(x, y, plateTextureRegion, GameActivity.this, darkFont, lightFont);

    plateComponent.setSize(w, h);

    getEngine().getScene().attachChild(plateComponent);
  }