This site requires JavaScript, please enable it in your browser!
Greenfoot back
Tommy_macaroni
Tommy_macaroni wrote ...

2020/3/7

hi, I have a background music playing for my scene, but have it play once after being pressed in stead of playing once more after being pressed again. please help! thanks guys!

Tommy_macaroni Tommy_macaroni

2020/3/7

#
   if (eDown != Greenfoot.isKeyDown("e"))
     {
       eDown = !eDown;
       if (eDown)
       {
          GreenfootSound Sound = new GreenfootSound("clone wars theme.mp3");
          Sound.play();
       }
danpost danpost

2020/3/8

#
Move line 6 to outside the method and change line 4 to:
if (eDown && ! Sound.isPlaying())
You need to login to post a reply.