• fullscreen
  • Moving_Rail_Car.pde
  • float a = 0;
    
    
    
    //railcar 
    
    //click to start engine
    
    void setup () {
      size(1080,520);
      fill(180,180,180);
      rect(100,100,900,250);
    frameRate(14);
    
    }
       
       
       
    void draw () {
     
    fill(180,180,180);
    a=a+1;
      line(100,103,1000,103);
      line(100,106,1000,106);
      line(100,109,1000,109);
      line(100,112,1000,112);
      line(100,115,1000,115);
      line(100,118,1000,118);
      line(100,121,1000,121);
      line(100,124,1000,124);
      
        line(100,346,1000,346);
    
        line(100,342,1000,342);
    
            line(100,338,1000,338);
            
           
    
        line(100,334,1000,334);
          
            line(100,330,1000,330);
    
        line(100,326,1000,326);
      
            line(100,322,1000,322);
            
               line(100,318,1000,318);
    
        line(100,314,1000,314);
    
            line(100,310,1000,310);
            
           
    
        line(100,306,1000,306);
          
            line(100,302,1000,302);
    
        line(100,298,1000,298);
      
            line(100,294,1000,294);
      
       line(100,290,1000,290);
    
        line(100,286,1000,286);
    
            line(100,282,1000,282);
            
           
    
        line(100,278,1000,278);
          
            line(100,274,1000,274);
    
        line(100,270,1000,270);
      
            line(100,266,1000,266);
       
            
              rect(110,130,110,220);
            fill(220,220,255);
       
            rect(115,135,100,100);
            rect(260,135,115,115);
            rect(400,135,115,115);
            rect(540,135,115,115);
            rect(680,135,115,115);
            rect(820,135,115,115);
            
      
      fill(40,20,10);
      ellipse(250,390,65,65);
      ellipse(350,390,65,65);
      ellipse(775,390,65,65);
      ellipse(875,390,65,65);
      
       fill(180,180,180);
       rect(815,350,20,50);
       rect(290,350,20,50);
      rect(210,380,180,20);
      rect(735,380,180,20);
      rect(95,340,5,20);
      rect(95,100,5,20);
    
    
    
    
      fill(175,170,164);
      quad(110,350,110,410,200,410,220,350);
      quad(910,350,960,410,990,410,990,350);
       rect(420,350,285,60);
       rect(1040,350,40,60);
       
       
      line(110,370.5,212,370);
      line(110,390,206,390);
      
    
      fill(40,20,10);
      ellipse(250,390,7,7);
      ellipse(350,390,7,7);
      ellipse(775,390,7,7);
      ellipse(875,390,7,7);
     rect(125,250,20,5);
    
      rect(70,360,40,10);
      rect(68,358,20,20);
      
       rect(990,360,30,10);
       rect(1005,360,35,10);
      rect(1005,358,20,20);
      
      rect(658,85,20,15);
      
      
      fill(20,20,20);
      
      rect(1000,125,16,220);
     rect(1016,125,16,220);
        rect(80,125,20,220);
      
      
      
      fill(180,180,180);
      rect(1032,100,100,250);
      
        line(1032,103,1080,103);
      line(1032,106,1080,106);
      line(1032,109,1080,109);
      line(1032,112,1080,112);
      line(1032,115,1080,115);
      line(1032,118,1080,118);
      line(1032,121,1080,121);
      line(1032,124,1080,124);
      
        line(1032,346,1080,346);
    
        line(1032,342,1080,342);
    
            line(1032,338,1080,338);
            
           
    
        line(1032,334,1080,334);
          
            line(1032,330,1080,330);
    
        line(1032,326,1080,326);
      
            line(1032,322,1080,322);
            
               line(1032,318,1080,318);
    
        line(1032,314,1080,314);
    
            line(1032,310,1080,310);
            
           
    
        line(1032,306,1080,306);
          
            line(1032,302,1080,302);
    
        line(1032,298,1080,298);
      
            line(1032,294,1080,294);
      
       line(1032,290,1080,290);
    
        line(1032,286,1080,286);
    
            line(1032,282,1080,282);
            
           
    
        line(1032,278,1080,278);
          
            line(1032,274,1080,274);
    
        line(1032,270,1080,270);
      
            line(1032,266,1080,266);
            
          
            
      //track
     
         
           fill(100,100,100);
            
       rect(0,423,1080,7);
       
       
       
    
       
      if(a==2){
        
           
       fill(180,180,180);
       rect(15,430,10,10);
      rect(40,430,10,10);
      rect(65,430,10,10);
        rect(90,430,10,10);
        rect(115,430,10,10);
        rect(140,430,10,10);
        rect(165,430,10,10);
        rect(190,430,10,10);
        rect(215,430,10,10);
        rect(240,430,10,10);
        rect(265,430,10,10);
        rect(290,430,10,10);
        rect(315,430,10,10);
        rect(340,430,10,10);
        rect(365,430,10,10);
        rect(390,430,10,10);
        rect(415,430,10,10);
        rect(440,430,10,10);
        rect(465,430,10,10);
        rect(490,430,10,10);
        rect(515,430,10,10);
        rect(540,430,10,10);
        rect(565,430,10,10);
        rect(590,430,10,10);
        rect(615,430,10,10);
        rect(640,430,10,10);
        rect(665,430,10,10);
        rect(690,430,10,10);
        rect(715,430,10,10);
        rect(740,430,10,10);
        rect(765,430,10,10);
        rect(790,430,10,10);
        rect(815,430,10,10);
        rect(840,430,10,10);
        rect(865,430,10,10);
        rect(890,430,10,10);
      rect(915,430,10,10);
      rect(940,430,10,10);
      rect(965,430,10,10);
      rect(990,430,10,10);
      rect(1015,430,10,10);
      rect(1040,430,10,10);
    rect(1065,430,10,10);
      rect(1090,430,10,10);
         
       fill(46,31,24);
       rect(0,430,15,10);
      rect(25,430,15,10);
      rect(50,430,15,10);
        rect(75,430,15,10);
        rect(100,430,15,10);
        rect(125,430,15,10);
        rect(150,430,15,10);
        rect(175,430,15,10);
        rect(200,430,15,10);
        rect(225,430,15,10);
        rect(250,430,15,10);
        rect(275,430,15,10);
        rect(300,430,15,10);
        rect(325,430,15,10);
        rect(350,430,15,10);
        rect(375,430,15,10);
        rect(400,430,15,10);
        rect(425,430,15,10);
        rect(450,430,15,10);
        rect(475,430,15,10);
        rect(500,430,15,10);
        rect(525,430,15,10);
        rect(550,430,15,10);
        rect(575,430,15,10);
        rect(600,430,15,10);
        rect(625,430,15,10);
        rect(650,430,15,10);
        rect(675,430,15,10);
        rect(700,430,15,10);
        rect(725,430,15,10);
        rect(750,430,15,10);
        rect(775,430,15,10);
        rect(800,430,15,10);
        rect(825,430,15,10);
        rect(850,430,15,10);
        rect(875,430,15,10);
      rect(900,430,15,10);
      rect(925,430,15,10);
      rect(950,430,15,10);
      rect(975,430,15,10);
      rect(1000,430,15,10);
      rect(1025,430,15,10);
    rect(1050,430,15,10);
      rect(1075,430,15,10);
       
    
       
      }
         if(a==1){
         fill(46,31,24);
       
       rect(10,430,15,10);
      rect(35,430,15,10);
      rect(60,430,15,10);
        rect(85,430,15,10);
        rect(110,430,15,10);
        rect(135,430,15,10);
        rect(160,430,15,10);
        rect(185,430,15,10);
        rect(210,430,15,10);
        rect(235,430,15,10);
        rect(260,430,15,10);
        rect(285,430,15,10);
        rect(310,430,15,10);
        rect(335,430,15,10);
        rect(360,430,15,10);
        rect(385,430,15,10);
        rect(410,430,15,10);
        rect(435,430,15,10);
        rect(460,430,15,10);
        rect(485,430,15,10);
        rect(510,430,15,10);
        rect(535,430,15,10);
        rect(560,430,15,10);
        rect(585,430,15,10);
        rect(610,430,15,10);
        rect(635,430,15,10);
        rect(660,430,15,10);
        rect(685,430,15,10);
        rect(710,430,15,10);
        rect(735,430,15,10);
        rect(760,430,15,10);
        rect(785,430,15,10);
        rect(810,430,15,10);
        rect(835,430,15,10);
        rect(860,430,15,10);
        rect(885,430,15,10);
      rect(910,430,15,10);
      rect(935,430,15,10);
      rect(960,430,15,10);
      rect(985,430,15,10);
      rect(1010,430,15,10);
      rect(1035,430,15,10);
    rect(1060,430,15,10);
      rect(1085,430,15,10);
         
     fill(180,180,180);
    rect(0,430,10,10);
    rect(25,430,10,10);
    rect(50,430,10,10);
    rect(75,430,10,10);
    rect(100,430,10,10);
    rect(125,430,10,10);
    rect(150,430,10,10);
    rect(175,430,10,10);
    rect(200,430,10,10);
     rect(225,430,10,10);
     rect(250,430,10,10);
     rect(275,430,10,10);
     rect(300,430,10,10);
     rect(325,430,10,10);
     rect(350,430,10,10);
     rect(375,430,10,10);
     rect(400,430,10,10);
     rect(425,430,10,10);
    rect(450,430,10,10);
    rect(475,430,10,10);
    rect(500,430,10,10);
    rect(525,430,10,10);
    rect(550,430,10,10);
    rect(575,430,10,10);
    rect(600,430,10,10);
     rect(625,430,10,10);
     rect(650,430,10,10);
     rect(675,430,10,10);
     rect(700,430,10,10);
     rect(725,430,10,10);
     rect(750,430,10,10);
     rect(775,430,10,10);
     rect(800,430,10,10);
     rect(825,430,10,10);
    rect(850,430,10,10);
    rect(875,430,10,10);
    rect(900,430,10,10);
     rect(925,430,10,10);
     rect(950,430,10,10);
     rect(875,430,10,10);
     rect(1000,430,10,10);
     rect(1025,430,10,10);
     rect(1050,430,10,10);
     rect(1075,430,10,10);
     rect(1100,430,10,10);
         }
      
      println(a);
       
       if(a>1){
         a=0;
       }
      
    
      
    
      
      
        //smoke
            
         
            if (mousePressed == true) {
             
            fill(35,25,25);
            ellipse(random(665,685),random(75,80),5,5);
            ellipse(random(675,695),random(65,75),5,5);
              ellipse(random(685,705),random(55,65),5,5);
              ellipse(random(695,715),random(45,55),5,5);
            ellipse(random(705,725),random(35,45),5,5);
            }
            
    }
               void mousePressed()  {
            loop();
            }
          
    
    
    

    code

    tweaks (0)

    license

    advertisement

    David Montoya

    Moving Rail Car

    Add to Faves Me Likey@! 1
    You must login/register to add this sketch to your favorites.

    Semi-fictional diesel rail car.

    Andy Brent
    21 Jun 2012
    OMG SO MUCH OF THIS CAN BE SIMPLIFIED
    Andy Brent
    21 Jun 2012
    I compressed everything but the tracks and added a fading smoke. If anyone knows how to create an for() function that won't reset when draw loops, please tell me.
    You need to login/register to comment.