File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ var dirtBagShakeSound;
1616var itemAtlas ;
1717var fullAtlas ;
1818
19- var MusicPlayer ;
2019function preload ( ) {
2120 // Load the default image
2221 //loadDefaultImage();
@@ -74,15 +73,6 @@ function preload() {
7473 gameUIFont = loadFont ( 'CalibrationGothicNbpLatin-rYmy.ttf' ) ;
7574 //console.log("font:", gameUIFont);
7675
77- // tell p5 which formats to expect
78- soundFormats ( 'wav' ) ;
79-
80- // loadSound paths are relative to your sketch.html
81- const mainTheme = loadSound ( 'audio/music/bgtheme.wav' ) ;
82- const battle = loadSound ( 'audio/music/battletheme.wav' ) ;
83- const ambiance = loadSound ( 'audio/music/WorkingAmbianceSample.wav' ) ;
84-
85- MusicPlayer = new MusicSystem ( mainTheme , [ battle , ambiance ] ) ;
8676 //load sounds
8777 let keys = Object . keys ( soundDic ) ;
8878 for ( let i = 0 ; i < keys . length ; i ++ ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var dirtBagUI = {};
1212var Debuging = false ;
1313
1414
15+ var MusicPlayer ;
1516
1617function setup ( ) {
1718 // Create a responsive canvas
@@ -22,6 +23,17 @@ function setup() {
2223 background ( 220 ) ;
2324 angleMode ( DEGREES ) ;
2425
26+
27+
28+ // tell p5 which formats to expect
29+ soundFormats ( 'wav' ) ;
30+
31+ // loadSound paths are relative to your sketch.html
32+ const mainTheme = loadSound ( 'audio/music/bgtheme.wav' ) ;
33+ const battle = loadSound ( 'audio/music/battletheme.wav' ) ;
34+ const ambiance = loadSound ( 'audio/music/WorkingAmbianceSample.wav' ) ;
35+
36+ MusicPlayer = new MusicSystem ( mainTheme , [ battle , ambiance ] ) ;
2537 // Prevent right-click context menu on p5.js canvases
2638 const canvases = document . getElementsByClassName ( "p5Canvas" ) ;
2739 for ( let element of canvases ) {
You can’t perform that action at this time.
0 commit comments