-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
52 lines (38 loc) · 830 Bytes
/
sketch.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
let engine;
let world;
var ball;
var ground;
var wedge;
var angle=60;
var poly;
var boxes=[];
function setup() {
createCanvas(400,400);
engine = Engine.create();
world = engine.world;
var option={
isStatic:true
};
ground=Bodies.rectangle(100,300,400,20);
World.add(world,ground);
//box1 = new Box(200,100,50,50);
rectMode(CENTER);
ellipseMode(RADIUS);
}
function mousePressed(){
boxes.push(
new Box(mouseX,mouseY,50,50)
)
}
function draw()
{
background(51);
rect(ground.position.x,ground.position.y,400,10);
Engine.update(engine);
for(var i=0;i<boxes.length;i++) {
boxes[i].show();}
}