InitialObjectDescriptor {
 objectDescriptorID 1
 audioProfileLevelIndication 1
 visualProfileLevelIndication 1
 sceneProfileLevelIndication 1
 graphicsProfileLevelIndication 1
 ODProfileLevelIndication 1
 esDescr [
  ES_Descriptor {
   ES_ID 1
   decConfigDescr DecoderConfigDescriptor {
    objectTypeIndication 2
    streamType 3
    bufferSizeDB 5000
    maxBitrate 13616
    avgBitrate 13616
    decSpecificInfo BIFSv2Config {
     nodeIDbits 10
     routeIDbits 10
     protoIDbits 10
     isCommandStream true
     pixelMetric true
     pixelWidth 500
     pixelHeight 500
    }
   }
   slConfigDescr SLConfigDescriptor {
    useAccessUnitStartFlag true
    useAccessUnitEndFlag true
    useTimeStampsFlag true
    timeStampResolution 1000
    timeStampLength 32
   }
  }
 ]
}

OrderedGroup {
 children [
  Background2D {
   backColor 1 1 1
  }
  WorldInfo {
   info [
    "This game was translated from" "the site http://javascript.internet.com'" 
    "Written and designed by Nick Young (ywing9787@aol.com)" 
    "Translated and adapted by " "Cyril Concolato (cyril.concolato@enst.fr), June 2003"
    "GPAC Regression Tests" "$Date: 2008-05-19 15:28:18 $ - $Revision: 1.3 $" "(C) 2002-2004 GPAC Team"
    ]
   title "Breakout using MPEG-4 BIFS and Javascript"
  }
  Transform2D {
   translation 0 200
   children [
    Shape {
     appearance Appearance {
      material Material2D {
       emissiveColor 0 0 0
       filled TRUE
      }
     }
     geometry Text {
      string ["Breakout Using MPEG-4 BIFS and Javascript"]
      fontStyle FontStyle {
       justify ["MIDDLE" "MIDDLE"]
       size 20
       style "BOLD"
      }
     }
    }
   ]
  }
  DEF N0 TimeSensor {
   cycleInterval 0.001
   enabled FALSE
   loop TRUE
  }
  Transform2D {
   translation -215 150
   children [
    DEF N1 TouchSensor {}
    Transform2D {
     translation 16 -16
     children [
      Transform2D {
       translation 197 -150
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0 0 0
           filled TRUE
          }
         }
         geometry Rectangle {
          size 394 300
         }
        }
       ]
      }
     ]
    }
    DEF N2 Transform2D {
     translation 21 -8
     children [
      Transform2D {
       translation 29 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry DEF N3 Rectangle {
          size 42 16
         }
        }
       ]
      }
      Transform2D {
       translation 75 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 121 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 167 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 213 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 259 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 305 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 351 -48
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 29 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 75 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 121 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 167 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 213 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 259 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 305 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 351 -68
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.75 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 29 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 75 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 121 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 167 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 213 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 259 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 305 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 351 -88
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.5 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 29 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 75 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 121 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 167 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 213 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 259 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 305 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 351 -108
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0.25 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 29 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 75 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 121 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 167 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 213 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 259 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 305 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
      Transform2D {
       translation 351 -128
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 0 0
           filled TRUE
          }
         }
         geometry USE N3
        }
       ]
      }
     ]
    }
    DEF N4 Transform2D {
     translation 209 -270
     children [
      Transform2D {
       translation 4 -4
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0.7 0.7 0.7
           filled TRUE
          }
         }
         geometry Rectangle {
          size 4 8
         }
        }
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0.7 0.7 0.7
           filled TRUE
          }
         }
         geometry Rectangle {
          size 8 4
         }
        }
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 1 1 1
           filled TRUE
          }
         }
         geometry Rectangle {
          size 4 4
         }
        }
       ]
      }
     ]
    }
    DEF N5 Transform2D {
     translation 193 -280
     children [
      Transform2D {
       translation 20 -2
       children [
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0.7 0.7 1
           filled TRUE
          }
         }
         geometry Rectangle {
          size 40 4
         }
        }
       ]
      }
     ]
    }
    DEF N6 Switch {
     whichChoice 0
     choice [
      Transform2D {
       translation 210 -215
       children [
        DEF N7 TouchSensor {}
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0.5 0.5 0.5
           filled TRUE
          }
         }
         geometry Rectangle {
          size 100 30
         }
        }
        Shape {
         appearance Appearance {
          material Material2D {
           emissiveColor 0 0 0
           filled TRUE
          }
         }
         geometry Text {
          string ["Start Game"]
          fontStyle FontStyle {
           justify ["MIDDLE" "MIDDLE"]
           size 20
          }
         }
        }
       ]
      }
     ]
    }
   ]
  }
  DEF N8 Script {
   eventIn SFBool startGame
   eventIn SFVec3f set_X
   eventIn SFTime tickTime
   field SFNode timer USE N0
   field SFNode ball USE N4
   field SFNode racket USE N5
   field SFNode starter USE N6
   field SFNode table USE N2
   field SFInt32 loadFLG 0
   field SFInt32 gameFLG 0
   field SFInt32 missFLG 0
   field SFTime tim 0
   field MFColor blcol [1 1 0 1 0.75 0 1 0.5 0 1 0.25 0 1 0 0 0 0 0]
   field MFInt32 blsta [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
   field MFInt32 blNO [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
   field SFInt32 blclr 0
   field SFFloat ballX 209
   field SFFloat ballY -270
   field SFInt32 ballN 5
   field SFFloat ballDX 0
   field SFFloat ballDY 0
   field SFFloat tmpRL 193
   url ["javascript:
function startGame(value) {
 if (value) {
  initG();
 }
}
function tickTime(value) {
 mainF();
}
function mainF() {
 ballX+=ballDX;
 ballY+=ballDY;
 outCHK();
 blkCHK();
 ball.translation.y=ballY;
 ball.translation.x=ballX;
 racket.translation.x=tmpRL;
}
function initG() {
 if (blclr>=40) {
  blclr=0;
  ballN=3;
  for (ib=0;ib<5;ib++){
   for (ia=0;ia<8;ia++){
    chc(ib*8+ia+1,ib);
    blsta[ib*8+ia]=ib;
   }
  }
 }
 starter.whichChoice=-1;
 gameFLG=1;
 loadFLG=1;
 ballX=209;
 ballY=-270;
 ballDX=-3;
 ballDY=3;
 tmpRL=193;
 missFLG=0;
}
function set_X(value) {
 if (loadFLG==1) {
  tmpRL=value.x + 197;
  if (tmpRL<21) {
   tmpRL=21;
  }
  if (tmpRL>373) {
   tmpRL=373;
  }
 }
}
function outCHK() {
 if (ballX<16) {
  ballX=32-ballX;
  ballDX=-ballDX;
 }
 if (ballX>401) {
  ballX=802-ballX;
  ballDX=-ballDX;
 }
 if (ballY>-16) {
  ballY=-32-ballY;
  ballDY=-ballDY;
 }
 if (ballY<=-272) {
  if (missFLG==0) {
   tmpX=(ballDX/ballDY)*(-272-ballY)+ballX;
   if (tmpX>=tmpRL-12) {
    if (tmpX<=tmpRL+42) {
     ballY=-272;
     ballDY=-ballDY;
     ballX=tmpX;
     ballRD=tmpX-tmpRL;
     ballDX=8*Math.abs(ballDX)/ballDX;
     if (ballRD<-4) {
      ballDX=-15;
     }
     if (ballRD>36) {
      ballDX=15;
     }
     if (ballRD>=14) {
      if (ballRD<=16) {
       ballDX=-2;
      }
     }
     if (ballRD>=17) {
      if (ballRD<=20) {
       ballDX=2;
      }
     }
     if (ballRD>=0) {
      if (ballRD<=4) {
       ballDX=-4;
      }
     }
     if (ballRD>=28) {
      if (ballRD<=32) {
       ballDX=4;
      }
     }
     if (ballRD>=-4) {
      if (ballRD<=-1) {
       ballDX=-11;
      }
     }
     if (ballRD>=33) {
      if (ballRD<=36) {
       ballDX=11;
      }
     }
    }
   }
   if (ballDY<0) {
    missFLG=1;
   }
  }
  else {
   if (ballY<-290) {
    missFLG=0;
    ballN=ballN-1;
    gameEnd();
   }
  }
 }
}
function blkCHK() {
 tmpY=ballY-4;
 tmpY=-tmpY;
 tmpX=ballX+4;
 if (tmpY>=48) {
  if (tmpY<=147) {
   if (tmpX>=29) {
    if (tmpX<=396) {
     ia=Math.floor((tmpX-29)/46);
     ib=Math.floor((tmpY-48)/20);
     ic=ib*8+ia;
     if (blsta[ic]<=4) {
      tmpbc=blsta[ic]+1;
      blsta[ic]=tmpbc;
      chc(ic+1,tmpbc);
      if (tmpbc==5) {
       blclr=blclr+1;
      }
      if (blclr>=40) {
       gameEnd();
      }
      if (ballDX>0) {
       iy=(-ballDY/ballDX)*(29+46*ia-tmpX)+tmpY;
       if (iy>48+20*ib+18) {
        tmpY1=48+20*ib+18;
        tmpX1=(ballDX/-ballDY)*(48+20*ib+18-tmpY)+tmpX;
        ballX=tmpX1-4;
        ballY=-(tmpY1+4);
        ballDY=-ballDY;
       }
       else {
        if (iy<44+20*ib) {
         tmpY1=48+20*ib;
         tmpX1=(ballDX/-ballDY)*(48+20*ib-tmpY)+tmpX;
         ballX=tmpX1-4;
         ballY=-(tmpY1+4);
         ballDY=-ballDY;
        }
        else {
         tmpX1=29+46*ia;
         tmpY1=(-ballDY/ballDX)*(29+46*ia-tmpX)+tmpY;
         ballX=tmpX1-4;
         ballY=-(tmpY1+4);
         ballDX=-ballDX;
        }
       }
      }
      else {
       iy=(-ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY;
       if (iy>48+20*ib+18) {
        tmpY1=48+20*ib+18;
        tmpX1=(ballDX/-ballDY)*(48+20*ib+18-tmpY)+tmpX;
        ballX=tmpX1-4;
        ballY=-(tmpY1+4);
        ballDY=-ballDY;
       }
       else {
        if (iy<44+20*ib) {
         tmpY1=48+20*ib;
         tmpX1=(ballDX/-ballDY)*(48+20*ib-tmpY)+tmpX;
         ballX=tmpX1-4;
         ballY=-(tmpY1+4);
         ballDY=-ballDY;
        }
        else {
         tmpX1=29+46*ia+44;
         tmpY1=(-ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY;
         ballX=tmpX1-4;
         ballY=-(tmpY1+4);
         ballDX=-ballDX;
        }
       }
      }
     }
    }
   }
  }
 }
}
function gameEnd() {
 gameFLG=0;
 loadFLG=0;
 timer.enabled=false;
 starter.whichChoice=0;
 if (ballN<=0) {
  blclr=40;
 }
}
function initialize() {
 for (ib=0;ib<5;ib++){
  for (ia=0;ia<8;ia++){
   blsta[ib*8+ia]=ib;
  }
 }
}
function chc(bno,bcl) {
 monBlock=table.children[bno-1].children[0].appearance.material;
 monBlock.emissiveColor=blcol[bcl];
}

"
   ]
  }
  DEF N9 Conditional {
   buffer {
    REPLACE N0.enabled BY TRUE
   }
  }
 ]
}

ROUTE N7.isActive TO N8.startGame
ROUTE N7.isActive TO N9.activate
ROUTE N0.cycleTime TO N8.tickTime
ROUTE N1.hitPoint_changed TO N8.set_X

