예제 #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);
 }