Saturday, December 5, 2015

javascript - Stop music in crafty.js


How do I stop a looping music file from playing in crafty.js? I want the music to stop playing once a gameover condition has been reached.



Answer



According to this issue page: Crafty.audio.stop("soundname"); or Crafty.audio.stop() to stop all sounds. Apparently the documentation is very out of date. The issue linked is from 10 months ago, and the documentation is still out of date.


However, you can always check the source code to see what's available to you.



No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...