🔍

planty balancy



// 0 _ idle / intro
// 1 - running mode
// 2 - ende

int main_mode = 0;

float sun_count = 0;
float rain_count = 0;

boolean is_raining = false;
boolean is_sunning = false;

float main_growth = 0;

void setup(){

  size(400,800);

}


void draw(){

  if(main_mode==0){
  
  
    background(22);
  
  }
  
  
  if(main_mode==1){
  
    if(is_sunning){
      sun_count++;
    }
    
    if(is_raining){
      rain_count++;
    }
  
    background(222);
    
    textSize(30);
    fill(0);
    
    
    
    text(int(sun_count),80,80  );
    text(int(rain_count),width-80,80);
  
    sun_count *= .9984;
    rain_count *= .992;
    
    float diff = abs(sun_count- rain_count );
    
     text(int(diff),width/2,180  );
     
     // check if sund and rain is very far away / differec
     if(diff < 15){
     
       // gut fürs wachstum
       main_growth++;
       fill(0,222,0);
       
       
       
     }else{
       // schelcht fürs wachstum
        fill(222,0,0);
        main_growth--;
     }
      
      rect(0,200,width,height );
     
     
  
  }



}


void mousePressed(){

  if( mouseButton == RIGHT){
    
    println("RIGHT");
    is_raining = true;
  
  }
  
   if( mouseButton == LEFT){
  
       println("LEFT");
       is_sunning = true;
    
  }
}


void mouseReleased(){

  is_sunning = false;
  is_raining = false;
  
}

void keyPressed(){
  
  println("init plant");
  main_mode = 1;

}