コード例 #1
0
  public void render(float delta) {
    shape.setColor(shapeRed * color, shapeGreen * color, shapeBlue * color, 1);
    shape.begin(ShapeType.Filled);
    shape.rect(shapeX, shapeY, shapeWidth, shapeHeight);
    shape.end();
    shape.setColor(0, 0, 0, 1);
    shape.begin(ShapeType.Line);
    shape.rect(shapeX, shapeY, shapeWidth, shapeHeight);
    shape.end();

    if (shapeX > Gdx.graphics.getWidth()) {
      if (!touched) {
        score.setSpeed(tempSpeed / 100);
        score.setHeight(shapeHeight);
        score.setWidth(shapeWidth);
        score.setState(false);
        lifeCount.setLifeCount(lifeCount.getLifeCount() - 1);
      }

      reset();
    } else {
      shapeX += tempSpeed * delta;

      if (beingTouched()) {
        score.setSpeed(tempSpeed / 100);
        score.setHeight(shapeHeight);
        score.setWidth(shapeWidth);
        score.setState(true);
        color = 1;
        touched = true;
      }
    }

    if (color > 0) {
      color -= 0.005;
    } else {
      color = 0;
    }
  }
コード例 #2
0
 public void create() {
   score = Score.getInstance();
   lifeCount = LifeCounter.getInstance();
   reset();
 }