-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathseeker.js
More file actions
82 lines (67 loc) · 1.99 KB
/
seeker.js
File metadata and controls
82 lines (67 loc) · 1.99 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// create tunnel shaded area
// figure out how to implement movement of the shaded area
// create an abstract class character, with image, x, y, and speed properties. also need movement and draw methods
// create a prop class, with a standard speed
// create a seeker class, with a faster speed
// potential class idea
class Seeker extends Sprite {
constructor (x, y, w, h, controllable, speed, image){
super(x, y, w, h, controllable, speed, image);
}
Seeker() {
// let seeker = {
// x: 200,
// y: 200,
// size: 40,
// draw: function () {
// noStroke();
// fill('orange');
// ellipse(this.x, this.y, this.size, this.size);
// }
// }
let flashlightVision = {
start: radians(230),
end: radians(-35),
draw: function () {
noStroke();
//flashlight vision
push();
beginClip({ invert: true });
arc(seeker.x, seeker.y, 450, 450, this.start, this.end, PIE);
endClip();
fill('black');
rect(0, 0, width, height)
pop();
}
}
this.setup = function () {
createCanvas(500, 500);
}
this.draw = function () {
background('Purple');
flashlightVision.draw();
seeker.draw();
if (keyIsPressed) {
if (keyCode == LEFT_ARROW) {
seeker.x--;
flashlightVision.start = radians(150);
flashlightVision.end = radians(210);
} else if (keyCode == RIGHT_ARROW) {
seeker.x++;
flashlightVision.start = radians(-30);
flashlightVision.end = radians(30);
}
if (keyCode == UP_ARROW) {
seeker.y--;
flashlightVision.start = radians(-120);
flashlightVision.end = radians(-60);
} else if (keyCode == DOWN_ARROW) {
seeker.y++;
flashlightVision.start = radians(60);
flashlightVision.end = radians(120);
}
}
}
// hard code the locations
}
}