Skip to content

Commit

Permalink
fixed show video checkbox going invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpjd committed Apr 15, 2024
1 parent 5cdf396 commit ba1dbce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gameobjects/videofeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VideoFeed extends GUIObject {
textAlign(LEFT);
fill(255,255,255);
textSize(15);
text("Show Video", 30, 85);
//text("Show Video", 30, 85);
pop();
} else {
showVideoCheckbox.hide();
Expand Down
17 changes: 17 additions & 0 deletions musicplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MusicPlayer{
if(!currentTrack.isPlaying()){
currentTrack=null;
}
/*
if(currentTrack==null){
if(this.isFirstTimePickingMusic){
currentTrack = music_Cages; //this is always the first track played
Expand All @@ -50,6 +51,22 @@ class MusicPlayer{
});
}
}
*/

if(currentTrack==null){
currentTrack = MusicPlayer.pickRandomTrack();
console.log("picking new track");
currentTrack.setVolume(0.4);
var response = currentTrack.play();
if (response!== undefined) {
response.then(_ => {
//the sound should start playing
this.isFirstTimePickingMusic = false;
}).catch(error => {
//simply handle the rror
});
}
}
}

static pickRandomTrack(){
Expand Down
4 changes: 2 additions & 2 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ function setup() {
//this is specifically chose to fit the hand detection and for gameplay balance; changing may break things
createCanvas(1000, 480);//this should come before anything that uses height/width

showVideoCheckbox = createCheckbox();
showVideoCheckbox = createCheckbox("Show Video");
//@ts-ignore
showVideoCheckbox.position(10, 70);
//showVideoCheckbox.position(10, 70);
//@ts-ignore
showVideoCheckbox.checked(false);

Expand Down
4 changes: 4 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ html, body {
color: white;
}

input {

}

canvas {
display: block;
}
Expand Down

0 comments on commit ba1dbce

Please sign in to comment.