Guest User

Untitled

a guest
Jul 2nd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mydate = new Date();
  2. var time = mydate.getHours();
  3.  
  4.  if(time >= 6 && time <= 12)
  5.  {
  6.      Music = new Sound(soundLoader);
  7.      Music.loadSound("morning.mp3", true);
  8.      
  9.      SFX = new Sound(this);
  10.      SFX.attachSound("morningsound");
  11.      SFX.start(0, 99);
  12.  
  13.  
  14.  }
  15.  else if(time >= 13 && time <= 16)
  16.  {
  17.       Music = new Sound(soundLoader);
  18.       Music.loadSound("day.mp3", true);
  19.      
  20.      SFX = new Sound(this);
  21.      SFX.attachSound("day");
  22.      SFX.start(0, 99);
  23.  }
  24.  else if(time >=17 && time <= 21)
  25.  {
  26.       Music = new Sound(soundLoader);
  27.       Music.loadSound("afternoon.mp3", true);
  28.      
  29.      SFX = new Sound(this);
  30.      SFX.attachSound("day");
  31.      SFX.start(0, 99);
  32.  }
  33.  else if(time >= 22 && time <= 5)
  34.  {
  35.     Music = new Sound(soundLoader);
  36.     Music.loadSound("nighttime.mp3", true);
  37.    
  38.      SFX = new Sound(this);
  39.      SFX.attachSound("night");
  40.      SFX.start(0, 99);
  41.  }
  42.  
  43. trace (time);
Add Comment
Please, Sign In to add comment