手軽にブラウザゲームを作るためのJavaScriptライブラリcrisp-game-libで利用できるSound Effectは全8種類。
crisp-game-lib自体でプログラムを作って鳴らしてみました。
レトロ感あっていいです。
動画で実行しているプログラム
main.js
1 | title = "SE Type" ; |
2 |
3 | description = ` |
4 | [Tap] to next |
5 | `; |
6 |
7 | characters = [ // 6x6 "a" as first array |
8 | ]; |
9 |
10 | options = { |
11 | theme: "crt" , |
12 | }; |
13 |
14 | /** @type{Array.<SoundEffectType>} */ |
15 | let soundType = [ "coin" , "laser" , "explosion" , "powerUp" , "hit" , "jump" , "select" , "lucky" ]; |
16 |
17 | let no; |
18 |
19 | function update() { |
20 | // init |
21 | if (!ticks){ |
22 | no = 0; |
23 | } |
24 |
25 | // draw sound name |
26 | color( "yellow" ); |
27 | let centerX = 100 / 2 - soundType[no].length * 6 / 2; |
28 | text(soundType[no], centerX, 50); |
29 |
30 | // tap to next |
31 | if (input.isJustPressed){ |
32 | no++; |
33 | if (no >= soundType.length) no = 0; |
34 | } |
35 |
36 | // play sound |
37 | if (!(ticks % 60)){ |
38 | play(soundType[no]); |
39 |
40 | } |
41 |
42 | } |
コメント