forked from yining1023/brickBreaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
youwin.js
37 lines (33 loc) · 994 Bytes
/
youwin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let soundtrack;
let filmReelLoop;
let youWinAnim;
function preload() {
soundtrack = loadSound('assets/SpiegelImSpiegelMonoShort.mp3');
filmReelLoop = loadSound('assets/mixkit-explainer-video-foley-projector-hybrid-film-antique-fade-pitch-bend-3012.wav');
youWinAnim = loadAnimation('sprites/youwin_variants/youwin-01.png', 'sprites/youwin_variants/youwin-08.png');
}
function setup() {
setupCanvas(false);
cursor(HAND);
soundtrack.loop();
filmReelLoop.loop();
filmReelLoop.setVolume(0.2);
}
function draw() {
// Chrome hack
if (!soundtrack.isPlaying()) {
soundtrack.loop();
}
if (!filmReelLoop.isPlaying()) {
filmReelLoop.loop();
filmReelLoop.setVolume(0.2);
}
background(255);
animation(youWinAnim, width / 2, height / 2);
}
function mouseReleased() {
userStartAudio(); // Chrome hack
if (mouseX < width && mouseX > 0 && mouseY < height && mouseY > 0) {
redirectToUrlFor('about');
}
}