-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
46 lines (33 loc) · 838 Bytes
/
main.js
File metadata and controls
46 lines (33 loc) · 838 Bytes
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
38
39
40
function preload() {
world_start = loadSound("world_start.wav");
mario_jump = loadSound("jump.wav");
mario_collect = loadSound("coin.wav");
mario_gameOver = loadSound("gameover.wav");
mario_kick = loadSound("kick.wav");
mario_die = loadSound("mariodie.wav")
setSprites();
MarioAnimation();
}
function setup() {
canvas = createCanvas(1240,336);
canvas.parent("canvas");
instializeInSetup(mario);
video = createCapture(VIDEO);
video.size(800, 400);
video.parent("gameConsole");
posenet = ml5.poseNet(video, loadSuccessful);
posenet.on("pose", gotPoses);
}
function loadSuccessful(){
console.log("posenet loaded successfully");
}
function gotPoses(results){
if(results.length > 0){
console.log(results);
noseX = results[0].pose.nose.x;
noseY = results[0].pose.nose.y;
}
}
function draw() {
game()
}