-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.js
More file actions
57 lines (45 loc) · 1.18 KB
/
Copy pathsketch.js
File metadata and controls
57 lines (45 loc) · 1.18 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const Engine = Matter.Engine;
const World= Matter.World;
const Bodies = Matter.Bodies;
var engine, world;
var box1,box2,box3,box4,box5,pig1,pig2;
var log1,log2,log3,log4;
var bird;
function setup(){
var canvas = createCanvas(1200,400);
engine = Engine.create();
world = engine.world;
box1 = new Box(700,320,70,70);
box2 = new Box(920,320,70,70);
box3 = new Box(700,240,70,70);
box4 = new Box(920,240,70,70);
box5 = new Box(810,160,70,70);
ground = new Ground(600,height,1200,20)
pig1 = new Pig(810,350);
pig2 = new Pig(810,220);
log1 = new Log(810,260,300, PI/2);
log2 = new Log(810,180,300, PI/2);
log3 = new Log(760,120,150, PI/7);
log4 = new Log(870,120,150, -PI/7);
bird = new Bird(100,100);
}
function draw(){
background(0);
Engine.update(engine);
console.log(box2.body.position.x);
console.log(box2.body.position.y);
console.log(box2.body.angle);
box1.display();
box2.display();
box3.display();
box4.display();
box5.display();
ground.display();
pig1.display();
pig2.display();
log1.display();
log2.display();
log3.display();
log4.display();
bird.display();
}