示例#1
0
 private static void initFractal(double shotDiam) {
   Game.engine.setBG(new Color(0.0f, 0.02f, 0.05f, 1.0f));
   new CBounds();
   HBRect rect = Game.engine.makeRect();
   rect.setPos(640, 360);
   rect.setDims(80);
   rect.commit(Double.POSITIVE_INFINITY);
   new CTarget(rect, CPlayerShip.COLOR);
   for (int i = 0; i < 8; i++) {
     double angle = 2 * Math.PI * i / 8.0;
     double cos = Math.cos(angle);
     double sin = Math.sin(angle);
     new CStickyGun(640 + cos * 350, 360 + sin * 350, angle + Math.PI, shotDiam);
   }
 }
示例#2
0
  private static void makePoolBorder() {
    Game.engine.setBG(new Color(0.0f, 0.7f, 0.2f, 1.0f));
    Color color = new Color(0.4f, 0.25f, 0.1f, 1.0f);

    for (int x = 0; x < 1280; x += 80) {
      HBRect rect = Game.engine.makeRect();
      rect.setPos(x + 40, 20);
      rect.setDims(80, 40);
      rect.commit(Double.POSITIVE_INFINITY);
      new CTarget(rect, color);
      rect = Game.engine.makeRect();
      rect.setPos(x + 40, 720 - 20);
      rect.setDims(80, 40);
      rect.commit(Double.POSITIVE_INFINITY);
      new CTarget(rect, color);
    }

    for (int y = 40; y < 720 - 40; y += 80) {
      HBRect rect = Game.engine.makeRect();
      rect.setPos(20, y + 40);
      rect.setDims(40, 80);
      rect.commit(Double.POSITIVE_INFINITY);
      new CTarget(rect, color);
      rect = Game.engine.makeRect();
      rect.setPos(1280 - 20, y + 40);
      rect.setDims(40, 80);
      rect.commit(Double.POSITIVE_INFINITY);
      new CTarget(rect, color);
    }
  }