Close

theCode #1

A project log for DI_UN_SWP

a project

steffiesteffie 08/12/2018 at 17:390 Comments

First attempt to put in the coding structure

second spread is already working pretty well.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

haven't tried on the actual tangible sensors yet, but will do and post an update!

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

on arduino:

Project Log Entry
for DI_UN_SWP


//on arduino:


#define firstbutton 5
#define secondbutton 4
#define thirdbutton 3


void setup() {
  pinMode(firstbutton,INPUT);
  pinMode(secondbutton,INPUT);
  pinMode(thirdbutton,INPUT);
  digitalWrite(firstbutton, HIGH);
  digitalWrite(secondbutton, HIGH);
  digitalWrite(thirdbutton, HIGH);
  Serial.begin(9600);
}

void loop() {

  if (digitalRead(firstbutton) == LOW) {
    Serial.println('1');
  } 
  if (digitalRead(secondbutton) == LOW) {
    Serial.println('2');
  } 
  if (digitalRead(thirdbutton) == LOW) {
    Serial.println('3');
  } else {
//    Serial.println("...");
  }
  delay(500);

} 

on processing:

import processing.serial.*;
import processing.video.*;
Serial myCommChannel;


//------------------Spread 1 Movie Bin------------------------------------------------------------

Movie wakeup01;
Movie walktobathroom02;
Movie waittoturnontap03;
Movie turnontap04;
Movie brushingteeth05;
Movie turnofftap06;
Movie outcome1A07;
Movie outcome1B08;
Movie continuewater09;
Movie finishbrushteeth10;
Movie walktoshower11;
Movie waittohotandcold12;
Movie outcomehot13;
Movie outcomecold14;
Movie shower15;
Movie finishshower16;
Movie waittopressswitch17;
Movie pressswitch18;
Movie outcome3A19;
Movie outcome3B20;
Movie goout21;

//-------------------Spread 2 Movie Bin-----------------------------------------------------------

Movie firstScene;
Movie secondScene;
Movie secondTwoScene;
Movie thirdScene;
Movie thirdTwoScene;
Movie fourthScene;
Movie fourthTwoScene;
Movie fourthThreeScene;
Movie fifthScene;
Movie sixthScene;
Movie sixthTwoScene;
Movie sixthThreeScene;
Movie seventhScene;
Movie infoOne;
Movie infoTwo;

//--------------------Spread 3 Movie Bin----------------------------------------------------------

Movie reachhome_301;
Movie sitdown_302;
Movie waittopressremote_303;
Movie pressremote_304;
Movie watchtv_305;
Movie walktofridge_306;
Movie waittoopenfridge_307;
Movie openfridge_308;
Movie getfood_309;
Movie outcomefridge_310;
Movie waittoclosefridge_311;
Movie closefridge_312;
Movie walkbacktocouch_313;
Movie yawn_314;
Movie outcome1A_315;
Movie outcome1B_316;
Movie walktobedroom_317;
Movie waittopressswitch_318;
Movie outcome2A_319;
Movie outcome2B_320;
Movie gosleep_321;



//--------------------Spread 1 Boolean----------------------------------------------------------

boolean wakeup101 = true;
boolean walk102 = false;
boolean waittap103 = false;
boolean turntapon104 = false;
boolean brushteeth105 = false;
boolean turntapoff106 = false;
boolean turntapoff106bad = false;
boolean outcomebadwater107 = false;
boolean outcomegoodwater108 = false;
boolean continuewater109 = false;
boolean finishbrush110 = false;
boolean walktoshower111 = false;
boolean waitheater112 = false;
boolean outcomehot113 = false;
boolean outcomecold114 = false;
boolean shower115 = false;
boolean finishshower116 = false;
boolean waitswitch1117 = false;
boolean pressswitch1118 = false;
boolean pressswitch1118bad = false;
boolean outcomebadlight119 = false;
boolean outcomegoodlight120 = false;
boolean goout121 = false;

//-------------------Spread 2 Boolean----------------------------------------------------------

boolean firstPlaying = false;
boolean secondPlaying = false;
boolean secondTwoPlaying = false;
boolean thirdPlaying = false;
boolean thirdTwoPlaying = false;
boolean fourthPlaying = false;
boolean fourthTwoPlaying = false;
boolean fourthThreePlaying = false;
boolean fifthPlaying = false;
boolean sixthPlaying = false;
boolean infoOnePlaying = false;
boolean infoTwoPlaying = false;
boolean sixthTwoPlaying = false;
boolean sixthThreePlaying = false;
boolean seventhPlaying = false;

//-------------------Spread 3 Boolean-----------------------------------------------------------

boolean gohome_3301 = false;
boolean sitdown_3302 = false;
boolean waitremote_3303 = false;
boolean pressremote_3304 = false;
boolean watchtv_3305 = false;
boolean walktofridge_3306 = false;
boolean waitfridge_3307 = false;
boolean openfridge_3308 = false;
boolean getfood_3309 = false;
boolean outcomefridge_3310 = false;
boolean waitfridgeclose_3311 = false;
boolean closefridge_3312 = false;
boolean walkback_3313 = false;
boolean yawn_3314 = false;
boolean waitremoteoff_3315 = false;
boolean pressremoteoff_3316 = false;
boolean pressremoteoff_3316bad = false;
boolean outcomebadremote_3317 = false;
boolean outcomegoodremote_3318 = false;
boolean walktobed_3319 = false;
boolean waitswitch3_3320 = false;
boolean pressswitch3_3321 = false;
boolean pressswitch3_3321bad = false;
boolean outcomebadswitch_3322 = false;
boolean outcomegoodswitch_3323 = false;
boolean gosleep_3324 = false;



//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

char inputChar = '?';


int myTime0101;
int myTime0102;
int myTime0103;

int myTime0201;
int myTime0202;
int myTime0203;

int myTime0301;
int myTime0302;
int myTime0303;

int waitTime = 10000;

void setup() {
  //size(1080,1920);
  size(480, 960);
  //fullScreen();
  surface.setResizable(true);
  //printArray(Serial.list());
  myCommChannel = new Serial(this, Serial.list()[3], 9600);

  //----------------Define Spread 1 Movie--------------------------------------------------------------

  wakeup01 = new Movie(this, "02_02_01.mp4");
  walktobathroom02 = new Movie(this, "02_02_02.mp4");
  waittoturnontap03 = new Movie(this, "02_02_03.mp4");
  turnontap04 = new Movie(this, "02_03_01.mp4");
  brushingteeth05 = new Movie (this, "02_03_02.mp4");
  turnofftap06 = new Movie(this, "02_04_01.mp4");
  outcome1A07 = new Movie(this, "02_04_02.mp4");
  outcome1B08 = new Movie(this, "02_04_03.mp4");
  continuewater09 = new Movie(this, "02_05.mp4");
  finishbrushteeth10 = new Movie(this, "02_06_01.mp4");
  walktoshower11 = new Movie(this, "02_06_02.mp4");
  waittohotandcold12 = new Movie(this, "02_06_03.mp4");
  outcomehot13 = new Movie(this, "02_07.mp4");
  outcomecold14 = new Movie(this, "infoOne.mp4");
  shower15 = new Movie(this, "infoTwo.mp4");
  finishshower16 = new Movie(this, "infoTwo.mp4");
  waittopressswitch17 = new Movie(this, "infoTwo.mp4");
  pressswitch18 = new Movie(this, "infoTwo.mp4");
  outcome3A19 = new Movie(this, "infoTwo.mp4");
  outcome3B20 = new Movie(this, "infoTwo.mp4");
  goout21 = new Movie(this, "infoTwo.mp4");

  //-----------------Define Spread 2 Movie-------------------------------------------------------------

  firstScene = new Movie(this, "02_02_01.mp4");
  secondScene = new Movie(this, "02_02_02.mp4");
  secondTwoScene = new Movie(this, "02_02_03.mp4");
  thirdScene = new Movie(this, "02_03_01.mp4");
  thirdTwoScene = new Movie (this, "02_03_02.mp4");
  fourthScene = new Movie(this, "02_04_01.mp4");
  fourthTwoScene = new Movie(this, "02_04_02.mp4");
  fourthThreeScene = new Movie(this, "02_04_03.mp4");
  fifthScene = new Movie(this, "02_05.mp4");
  sixthScene = new Movie(this, "02_06_01.mp4");
  sixthTwoScene = new Movie(this, "02_06_02.mp4");
  sixthThreeScene = new Movie(this, "02_06_03.mp4");
  seventhScene = new Movie(this, "02_07.mp4");
  infoOne = new Movie(this, "infoOne.mp4");
  infoTwo = new Movie(this, "infoTwo.mp4");

  //---------------Define Spread 3 Movie---------------------------------------------------------------

  reachhome_301 = new Movie(this, "02_02_01.mp4");
  sitdown_302 = new Movie(this, "02_02_02.mp4");
  waittopressremote_303 = new Movie(this, "02_02_03.mp4");
  pressremote_304 = new Movie(this, "02_03_01.mp4");
  watchtv_305 = new Movie (this, "02_03_02.mp4");
  walktofridge_306 = new Movie(this, "02_04_01.mp4");
  waittoopenfridge_307 = new Movie(this, "02_04_02.mp4");
  openfridge_308 = new Movie(this, "02_04_03.mp4");
  getfood_309 = new Movie(this, "02_05.mp4");
  outcomefridge_310 = new Movie(this, "02_06_01.mp4");
  waittoclosefridge_311 = new Movie(this, "02_06_02.mp4");
  closefridge_312 = new Movie(this, "02_06_03.mp4");
  walkbacktocouch_313 = new Movie(this, "02_07.mp4");
  yawn_314 = new Movie(this, "infoOne.mp4");
  outcome1A_315 = new Movie(this, "infoTwo.mp4");
  outcome1B_316 = new Movie(this, "infoTwo.mp4");
  walktobedroom_317 = new Movie(this, "infoTwo.mp4");
  waittopresswitch_318 = new Movie(this, "infoTwo.mp4");
  outcome2A_319 = new Movie(this, "infoTwo.mp4");
  outcome2B_320 = new Movie(this, "infoTwo.mp4");
  gosleep_321 = new Movie(this, "infoTwo.mp4");
}


void draw()
{
  //background (70);
  //printArray(Serial.list());

  inputChar = myCommChannel.readChar();

  //-------------------SPREAD 1---------------------------------------------------
  //------------------------------------------------------------------------------

  if (wakeup101) {
    play101();
  }
  if (walk102) {
    play102();
  }
  if (waittap103) {
    play103();
  }
  if (turntapon104) {
    play104();
  }
  if (brushteeth105) {
    play105();
  }
  if (turntapoff106) {
    play106();
  }
  if (turntapoff106bad) {
    play106bad();
  }
  if (outcomebadwater107) {
    play107();
  }
  if (outcomegoodwater108) {
    play108();
  }
  if (continuewater109) {
    play109();
  }
  if (finishbrush110) {
    play110();
  }
  if (walktoshower111) {
    play111();
  }
  if (waitheater112) {
    play112();
  }
  if (outcomehot113) {
    play113();
  }
  if (outcomecold114) {
    play114();
  }
  if (shower115) {
    play115();
  }
  if (finishshower116) {
    play116();
  }
  if (waitswitch1117) {
    play117();
  }
  if (pressswitch1118) {
    play118();
  }
  if (pressswitch1118bad) {
    play118bad();
  }
  if (outcomebadlight119) {
    play119();
  }
  if (outcomegoodlight120) {
    play120();
  }
  if (goout121) {
    play121();
  }


  //-------------------SPREAD 2---------------------------------------------------
  //------------------------------------------------------------------------------

  if (firstPlaying) {
    playFirstScene();
  }
  if (secondPlaying) {
    playSecondScene();
  }
  if (secondTwoPlaying) {
    playSecondTwoScene();
  }
  if (thirdPlaying) {
    playThirdScene();
  }
  if (thirdTwoPlaying) {
    playThirdTwoScene();
  }
  if (fourthPlaying) {
    playFourthScene();
  }
  if (fourthTwoPlaying) {
    playFourthTwoScene();
  }
  if (fourthThreePlaying) {
    playFourthThreeScene();
  }
  if (fifthPlaying) {
    playFifthScene();
  }
  if (sixthPlaying) {
    playSixthScene();
  }
  if (infoOnePlaying) {
    playInfoOne();
  }
  if (sixthTwoPlaying) {
    playSixthTwoScene();
  }
  if (infoTwoPlaying) {
    playInfoTwo();
  } 
  if (sixthThreePlaying) {
    playSixthThreeScene();
  }
  if (seventhPlaying) {
    playSeventhScene();
  }

  //-------------------SPREAD 3---------------------------------------------------
  //------------------------------------------------------------------------------

  if (gohome_3301) {
    play301();
  }
  if (sitdown_3302) {
    play302();
  }
  if (waitremote_3303) {
    play303();
  }
  if (pressremote_3304) {
    play304();
  }
  if (watchtv_3305) {
    play305();
  }
  if (walktofridge_3306) {
    play306();
  }
  if (waitfridge_3307) {
    play307();
  }
  if (openfridge_3308) {
    play308();
  }
  if (getfood_3309) {
    play309();
  }
  if (outcomefridge_3310) {
    play310();
  }
  if (waitfridgeclose_3311) {
    play311();
  }
  if (closefridge_3312) {
    play312();
  }
  if (walkback_3313) {
    play313();
  }
  if (yawn_3314) {
    play314();
  }
  if (waitremoteoff_3315) {
    play315();
  }
  if (pressremoteoff_3316) {
    play316();
  }
  if (pressremoteoff_3316bad) {
    play316bad();
  }
  if (outcomebadremote_3317) {
    play317();
  }
  if (outcomegoodremote_3318) {
    play318();
  }
  if (walktobed_3319) {
    play319();
  }
  if (waitswitch3_3320) {
    play320();
  }
  if (pressswitch3_3321) {
    play321();
  }
  if (pressswitch3_3321bad) {
    play321bad();
  }
  if (outcomebadswitch_3322) {
    play322();
  }
  if (outcomegoodswitch_3323) {
    play323();
  }
  if (gosleep_3324) {
    play324();
  }
}


//-------------------SPREAD 1---------------------------------------------------
//------------------------------------------------------------------------------


void play101() {
  wakeup01.play();
  image(wakeup01, 0, 0, width, height);
  if (wakeup01.time() >= wakeup01.duration()-0.3 ) {
    wakeup01.stop();
    wakeup101 = false;
    walk102 = true;
  }
}
void play102() {
  walktobathroom02.play();
  image(walktobathroom02, 0, 0, width, height);
  if (walktobathroom02.time() >= walktobathroom02.duration()-0.3 ) {
    walktobathroom02.stop();
    walk102 = false;
    waittap103 = true;
  }
}
void play103() {
  waittoturnontap03.loop();
  image(waittoturnontap03, 0, 0, width, height);
  switch (inputChar) {
  case 51: 
    waittoturnontap03.stop();
    waittap103=false;
    turntapon104 = true;
  }
}

void play104() {
  turnontap04.play();
  image(turnontap04, 0, 0, width, height);
  if (turnontap04.time() >= turnontap04.duration()-0.3 ) {
    turnontap04.stop();
    turntapon104 = false;
    startCounting1One();
    brushteeth105 = true;
  }
}

void startCounting1One() {
  myTime0101 = millis();
}

void play105() {
  brushingteeth05.loop();
  image(brushingteeth05, 0, 0, width, height);
  if (millis() - myTime0101 >= waitTime) {
    brushingteeth05.stop();
    brushteeth105=false;
    outcomebadwater107 = true;
  }
  switch (inputChar) {
  case 49: 
    brushingteeth05.stop();
    brushteeth105=false;
    turntapoff106 = true;
  }
}

void play106() {
  turnofftap06.play();
  image(turnofftap06, 0, 0, width, height);
  if (turnofftap06.time() >= turnofftap06.duration()-0.3 ) {
    turnofftap06.stop();
    turntapoff106 = false;
    outcomegoodwater108 = true;
  }
}

void play107() {
  outcome1A07.loop();
  image(outcome1A07, 0, 0, width, height);
  switch (inputChar) {
  case 49: 
    outcome1A07.stop();
    outcomebadwater107=false;
    turntapoff106bad = true;
  }
}

void play106bad() {
  turnofftap06.play();
  image(turnofftap06, 0, 0, width, height);
  if (turnofftap06.time() >= turnofftap06.duration()-0.3 ) {
    turnofftap06.stop();
    turntapoff106 = false;
    continuewater109 = true;
  }
}

void play108() {
  outcome1B08.play();
  image(outcome1B08, 0, 0, width, height);
  if (outcome1B08.time() >= outcome1B08.duration()-0.3 ) {
    outcome1B08.stop();
    outcomegoodwater108 = false;
    continuewater109 = true;
  }
}

void play109() {
  continuewater09.play();
  image(continuewater09, 0, 0, width, height);
  if (continuewater09.time() >= continuewater09.duration()-0.3 ) {
    continuewater09.stop();
    continuewater109 = false;
    finishbrush110 = true;
  }
}

void play110() {
  finishbrushteeth10.play();
  image(finishbrushteeth10, 0, 0, width, height);
  if (finishbrushteeth10.time() >= finishbrushteeth10.duration()-0.3 ) {
    finishbrushteeth10.stop();
    finishbrush110 = false;
    walktoshower111 = true;
  }
}

void play111() {
  walktoshower11.play();
  image(walktoshower11, 0, 0, width, height);
  if (walktoshower11.time() >= walktoshower11.duration()-0.3 ) {
    walktoshower11.stop();
    walktoshower111 = false;
    waitheater112 = true;
  }
}

void play112() {
  waittohotandcold12.loop();
  image(waittohotandcold12, 0, 0, width, height);
  switch (inputChar) {
  case 49: 
    waittohotandcold12.stop();
    waitheater112=false;
    startCounting1Two();
    outcomehot113 = true;

  case 51: 
    waittohotandcold12.stop();
    waitheater112=false;
    startCounting1Two();
    outcomecold114 = true;
  }
}

void startCounting1Two() {
  myTime0102 = millis();
}

void play113() {
  outcomehot13.loop();
  image(outcomehot13, 0, 0, width, height);
  if (millis() - myTime0102 >= waitTime) {
    outcomehot13.stop();
    outcomehot113=false;
    shower115 = true;
  }
}

void play114() {
  outcomecold14.loop();
  image(outcomecold14, 0, 0, width, height);
  if (millis() - myTime0102 >= waitTime) {
    outcomecold14.stop();
    outcomecold114=false;
    shower115 = true;
  }
}

void play115() {
  shower15.play();
  image(shower15, 0, 0, width, height);
  if (shower15.time() >= shower15.duration()-0.3 ) {
    shower15.stop();
    shower115 = false;
    finishshower116 = true;
  }
}

void play116() {
  finishshower16.play();
  image(finishshower16, 0, 0, width, height);
  if (finishshower16.time() >= finishshower16.duration()-0.3 ) {
    finishshower16.stop();
    finishshower116 = false;
    startCounting1Three();
    waitswitch1117 = true;
  }
}

void startCounting1Three() {
  myTime0103 = millis();
}

void play117() {
  waittopressswitch17.loop();
  image(waittopressswitch17, 0, 0, width, height);
  if (millis() - myTime0103 >= waitTime) {
    waittopressswitch17.stop();
    waitswitch1117=false;
    outcomebadlight119 = true;
  }
  switch (inputChar) {
  case 49: 
    waittopressswitch17.stop();
    waitswitch1117=false;
    pressswitch1118 = true;
  }
}

void play118() {
  pressswitch18.play();
  image(pressswitch18, 0, 0, width, height);
  if (pressswitch18.time() >= pressswitch18.duration()-0.3 ) {
    pressswitch18.stop();
    pressswitch1118 = false;
    outcomegoodlight120 = true;
  }
}

void play119() {
  outcome3A19.loop();
  image(outcome3A19, 0, 0, width, height);
  switch (inputChar) {
  case 49: 
    outcome3A19.stop();
    outcomebadlight119=false;
    pressswitch1118bad = true;
  }
}

void play118bad() {
  pressswitch18.play();
  image(pressswitch18, 0, 0, width, height);
  if (pressswitch18.time() >= pressswitch18.duration()-0.3 ) {
    pressswitch18.stop();
    pressswitch1118bad = false;
    goout121 = true;
  }
}

void play120() {
  outcome3B20.play();
  image(outcome3B20, 0, 0, width, height);
  if (outcome3B20.time() >= outcome3B20.duration()-0.3 ) {
    outcome3B20.stop();
    outcomegoodlight120 = false;
    goout121 = true;
  }
}

void play121() {
  goout21.play();
  image(goout21, 0, 0, width, height);
  if (goout21.time() >= goout21.duration()-0.3 ) {
    goout21.stop();
    goout121 = false;
    //goout121 = true;
  }
}


//-------------------SPREAD 2---------------------------------------------------
//------------------------------------------------------------------------------


void playFirstScene() {
  firstScene.play();
  image(firstScene, 0, 0, width, height);
  if (firstScene.time() >= firstScene.duration()-0.3 ) {
    firstScene.stop();
    firstPlaying = false;
    secondPlaying = true;
  }
}

void playSecondScene() {
  secondScene.play();
  image(secondScene, 0, 0, width, height);
  if (secondScene.time() >= secondScene.duration()-0.3) {
    secondScene.stop();
    secondPlaying = false;
    secondTwoPlaying = true;
  }
}

void playSecondTwoScene() {
  secondTwoScene.play();
  image(secondTwoScene, 0, 0, width, height);
  if (secondTwoScene.time() >= secondTwoScene.duration()-0.3) {
    secondTwoScene.stop();
    secondTwoPlaying = false;
    thirdPlaying = true;
  }
}

void playThirdScene() {
  thirdScene.loop();
  image(thirdScene, 0, 0, width, height);
  switch (inputChar) {
  case 49: 
    thirdScene.stop();
    thirdPlaying=false;
    thirdTwoPlaying = true;
  }
}

void playThirdTwoScene() {
  thirdTwoScene.play();
  image(thirdTwoScene, 0, 0, width, height);
  if (thirdTwoScene.time() >= thirdTwoScene.duration()-0.3) {
    thirdTwoScene.stop();
    thirdTwoPlaying=false;
    fourthPlaying = true;
  }
}

void playFourthScene() {
  fourthScene.loop();
  image(fourthScene, 0, 0, width, height);
  switch (inputChar) {
  case 50: 
    fourthScene.stop();
    fourthPlaying=false;
    fourthTwoPlaying = true;
  }
}

void playFourthTwoScene() {
  fourthTwoScene.play();
  image(fourthTwoScene, 0, 0, width, height);
  if (fourthTwoScene.time() >= fourthTwoScene.duration()-0.3) {
    fourthTwoScene.stop();
    fourthTwoPlaying=false;
    fourthThreePlaying = true;
  }
}

void playFourthThreeScene() {
  fourthThreeScene.play();
  image(fourthThreeScene, 0, 0, width, height);
  if (fourthThreeScene.time() >= fourthThreeScene.duration()-0.3) {
    fourthThreeScene.stop();
    fourthThreePlaying=false;
    fifthPlaying = true;
  }
}

void playFifthScene() {
  fifthScene.play();
  image(fifthScene, 0, 0, width, height);
  if (fifthScene.time() >= fifthScene.duration()-0.3) {
    fifthScene.stop();
    fifthPlaying=false;
    startCounting2();
    //println(myTime);
    sixthPlaying = true;
  }
}

void startCounting2() {
  myTime0201 = millis();
}

void playSixthScene() {
  sixthScene.loop();
  image(sixthScene, 0, 0, width, height);
  if (millis() - myTime0201 >= waitTime) {
    sixthScene.stop();
    sixthPlaying=false;
    startCounting2Two();
    infoOnePlaying = true;
    println("this is detected");
  }
  switch (inputChar) {
  case 51: 
    sixthScene.stop();
    sixthPlaying=false;
    sixthTwoPlaying = true;
    println("good");
  }
}

void startCounting2Two() {
  myTime0202 = millis();
}

void playInfoOne() {
  println("playing info one");
  infoOne.loop();
  image(infoOne, 0, 0, width, height);
  if (millis() - myTime0202 >= waitTime) {
    infoOne.stop();
    infoOnePlaying=false;
    sixthThreePlaying = true;
  }
}

void playSixthTwoScene() {
  sixthTwoScene.play();
  image(sixthTwoScene, 0, 0, width, height);
  if (sixthTwoScene.time() >= sixthTwoScene.duration()-0.3) {
    sixthTwoScene.stop();
    sixthTwoPlaying = false;
    startCounting2Three();
    infoTwoPlaying = true;
  }
}

void startCounting2Three() {
  myTime0203 = millis();
}

void playInfoTwo() {
  infoTwo.loop();
  image(infoTwo, 0, 0, width, height);
  if (millis() - myTime0203 >= waitTime) {
    infoTwo.stop();
    infoTwoPlaying=false;
    sixthThreePlaying = true;
  }
}

void playSixthThreeScene() {
  sixthThreeScene.play();
  image(sixthThreeScene, 0, 0, width, height);
  if (sixthThreeScene.time() >= sixthThreeScene.duration()-0.3) {
    sixthThreeScene.stop();
    sixthThreePlaying = false;
    seventhPlaying = true;
  }
}

void playSeventhScene() {
  seventhScene.play();
  image(seventhScene, 0, 0, width, height);
  if (seventhScene.time() >= seventhScene.duration()-0.3) {
    seventhScene.stop();
    seventhPlaying=false;
    //firstPlaying = true;
  }
}

//-------------------SPREAD 3---------------------------------------------------
//------------------------------------------------------------------------------

void play301() {
  reachhome_301.play();
  image(reachhome_301, 0, 0, width, height);
  if (reachhome_301.time() >= reachhome_301.duration()-0.3 ) {
    reachhome_301.stop();
    gohome_3301 = false;
    sitdown_3302 = true;
  }
}

void play302() {
  sitdown_302.play();
  image(sitdown_302, 0, 0, width, height);
  if (sitdown_302.time() >= sitdown_302.duration()-0.3 ) {
    sitdown_302.stop();
    sitdown_3302 = false;
    waitremote_3303 = true;
  }
}

void play303() {
  waittopressremote_303.loop();
  image(waittopressremote_303, 0, 0, width, height);
  switch (inputChar) {
  case 50: 
    waittopressremote_303.stop();
    waitremote_3303=false;
    pressremote_3304 = true;
  }
}

void play304() {
  pressremote_304.play();
  image(pressremote_304, 0, 0, width, height);
  if (pressremote_304.time() >= pressremote_304.duration()-0.3 ) {
    pressremote_304.stop();
    pressremote_3304 = false;
    watchtv_3305 = true;
  }
}

void play305() {
  watchtv_305.play();
  image(watchtv_305, 0, 0, width, height);
  if (watchtv_305.time() >= watchtv_305.duration()-0.3 ) {
    watchtv_305.stop();
    watchtv_3305 = false;
    walktofridge_3306 = true;
  }
}

void play306() {
  walktofridge_306.play();
  image(walktofridge_306, 0, 0, width, height);
  if (walktofridge_306.time() >= walktofridge_306.duration()-0.3 ) {
    walktofridge_306.stop();
    walktofridge_3306 = false;
    waitfridge_3307 = true;
  }
}

void play307() {
  waittoopenfridge_307.loop();
  image(waittoopenfridge_307, 0, 0, width, height);
  switch (inputChar) {
  case 50: 
    waittoopenfridge_307.stop();
    waitfridge_3307=false;
    openfridge_3308 = true;
  }
}

void play308() {
  openfridge_308.play();
  image(openfridge_308, 0, 0, width, height);
  if (openfridge_308.time() >= openfridge_308.duration()-0.3 ) {
    openfridge_308.stop();
    openfridge_3308 = false;
    getfood_3309 = true;
  }
}

void play309() {
  getfood_309.play();
  image(getfood_309, 0, 0, width, height);
  if (getfood_309.time() >= getfood_309.duration()-0.3 ) {
    getfood_309.stop();
    getfood_3309 = false;
    startCounting3One();
    outcomefridge_3310 = true;
  }
}

startCounting3One() {
  myTime0301 = millis();
}

void play310() {
  outcomefridge_301.loop();
  image(outcomefridge_301, 0, 0, width, height);
  if (millis() - myTime0301 >= waitTime) {
    outcomefridge_301.stop();
    outcomefridge_3310=false;
    waitfridgeclose_3311 = true;
  }
}

void play311() {
  waittoclosefridge_311.loop();
  image(waittoclosefridge_311, 0, 0, width, height);
  switch (inputChar) {
  case 50: 
    waittoclosefridge_311.stop();
    waitfridgeclose_3311=false;
    closefridge_3312 = true;
  }
}

void play312() {
  closefridge_312.play();
  image(closefridge_312, 0, 0, width, height);
  if (closefridge_312.time() >= closefridge_312.duration()-0.3 ) {
    closefridge_312.stop();
    closefridge_3312 = false;
    walkback_3313 = true;
  }
}

void play313() {
  walkbacktocouch_313.play();
  image(walkbacktocouch_313, 0, 0, width, height);
  if (walkbacktocouch_313.time() >= walkbacktocouch_313.duration()-0.3 ) {
    walkbacktocouch_313.stop();
    walkback_3313 = false;
    yawn_3314 = true;
  }
}

void play314() {
  yawn_314.play();
  image(yawn_314, 0, 0, width, height);
  if (yawn_314.time() >= yawn_314.duration()-0.3 ) {
    yawn_314.stop();
    yawn_3314 = false;
    startCounting3Two();
    waitremoteoff_3315 = true;
  }
}

void startCounting3Two() {
  myTime0302 = millis();
}

void play315() {
  waittopressremote_303.loop();
  image(waittopressremote_303, 0, 0, width, height);
  if (millis() - myTime0302 >= waitTime) {
    waittopressremote_303.stop();
    waitremoteoff_3315=false;
    outcomebadremote_3317 = true;
  }
  switch (inputChar) {
  case 49: 
    waittopressremote_303.stop();
    waitremoteoff_3315 = false;
    pressremoteoff_3316 = true;
  }
}

void play316() {
  pressremote_3304.play();
  image(pressremote_3304, 0, 0, width, height);
  if (pressremote_3304.time() >= pressremote_3304.duration()-0.3 ) {
    pressremote_3304.stop();
    pressremoteoff_3316 = false;
    startCounting3Three();
    outcomegoodremote_3318 = true;
  }
}

void startCounting3Three() {
  myTime0303 = millis();
}

void play317() {
  outcome1A_315.loop();
  image(outcome1A_315, 0, 0, width, height);
  switch (inputChar) {
  case 50: 
    outcome1A_315.stop();
    outcomebadremote_3317 =false;
    pressremoteoff_3316bad = true;
  }
}

void play316bad() {
  pressremote_304.play();
  image(pressremote_304, 0, 0, width, height);
  if (pressremote_304.time() >= pressremote_304.duration()-0.3 ) {
    pressremote_304.
        

Discussions