-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
57 lines (38 loc) · 860 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
53
54
55
56
57
let solidObjects;
let barraL;
let barraR;
let bola;
let powerup;
let time;
function setup() {
createCanvas(displayWidth, displayHeight);
noStroke();
fill(255);
textSize(700);
textAlign(CENTER, CENTER);
ellipseMode(CORNER);
barraL = new Pad(20, 140, [83, 87]);
barraR = new Pad(width - 60, 140, [40, 38]);
bola = new Ball(300, 200, -50, 0, barraL);
solidObjects = [barraL, barraR];
powerup = new PowerUp();
}
function mousePressed() {
let fs = fullscreen();
fullscreen(!fs);
}
function draw() {
blendMode(BLEND);
background(0);
rect(width / 2, 0, 20, height);
blendMode(DIFFERENCE);
barraL.move();
barraR.move();
bola.move();
powerup.collide();
bola.points(barraL, barraR);
barraL.draw();
barraR.draw();
bola.draw();
powerup.draw();
}