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

2019/11/16

Sound = playing a sound of a World, if no other Sound is playing

ITStudent ITStudent

2019/11/16

#
I have a Problem (again) This Time its a bit tricky: A World plays a Sound and if this is not playing, than the Sound should play. BUT it works fine! My Problem: WorldA plays a Sound with the Script: if(!song.isPlaying()){song.play();} WorldB : if(!song2.isPlaying()){song2.play();} But he should also recognize if the Sound of WorldA is playing too or not So i thought about null.isPlaying() (= not working) and GreenfootSound.isPlaying() (=non static problem) What should i do? Thanks a lot!
danpost danpost

2019/11/16

#
Maybe you should check out my BGMusic Actor Class Demo scenario.
ITStudent ITStudent

2019/11/16

#
Yeah i did. But the solution isnt there. I dont want a direct stop if a world changes. I want if World A changes to World B, that Song B starts if Song A stopped itself playing. Is it possible in Greenfoot?
ITStudent ITStudent

2019/11/16

#
Looking on this page if i can solve the problem: https://www.greenfoot.org/topics/8947/0
ITStudent ITStudent

2019/11/16

#
Finally it works. Thank You I just typed public static final before GreenfootSound and now everything works fine. Chapter closed! :D
You need to login to post a reply.