示例#1
0
文件: War.java 项目: RadianSmile/War
  public void draw() {
    switch (gameState) {
      case START:
        background(0);
        break;
      case PLAY:
        background(100);
        sun.display();
        sun.update();

        garden.display();
        garden.update();

        milk.update();
        milk.display();

        textSize(20);
        text("Sun : " + sunGrade, 10, 20);

        // Sun collision test
        if (isHit(sun.x, sun.y, sun.w, sun.h, mouseX, mouseY, 0, 0)) {
          sun.getEaten();
          sunGrade += 50;
        }

        // Bullet collision test

        break;
      case WIN:
        break;
      case LOSE:
        break;
    }
  }
示例#2
0
文件: War.java 项目: RadianSmile/War
 public void mouseReleased() {
   if (fruitOption == Banana && sunGrade >= BananCost) {
     sunGrade -= BananCost;
   } else if (fruitOption == Melon) {
     sunGrade -= BananCost;
   } else return;
   garden.addPlant(fruitOption, mouseX, mouseY);
 }