Commit 9d0cb31e by Mike Zhu

修改随机播放catched逻辑

parent 3cf276e6
...@@ -34,11 +34,11 @@ class SoundManager { ...@@ -34,11 +34,11 @@ class SoundManager {
const soundName = [ const soundName = [
'catched_0_mp3', 'catched_0_mp3',
'catched_2_mp3', 'catched_2_mp3',
][num || this.rnd(0, 1)] ][num || (this.rnd(2) - 1)]
this.play({soundName}) this.play({ soundName })
} }
rnd(start, end) { rnd(n) {
return Math.floor(Math.random() * (end - start) + start) return (Math.floor(Math.random() * n + 1));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment