-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathquad.js
More file actions
136 lines (115 loc) · 3.86 KB
/
quad.js
File metadata and controls
136 lines (115 loc) · 3.86 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function Quad() {
// creates a new array of sprites
let sprites = [];
// let mapOn = false;
// let miniMap = {
// x: 50,
// y: 50,
// size: 400,
// draw: function () {
// fill('orange');
// rect(this.x, this.y, this.size, this.size);
// }
// };
this.setup = function () {
// music stuff
music.stopAll();
music.Quad.loop();
// pushes sprites into the sprite array
for(let i = 0; i < 9; i++){
sprites.push(new Sprite(propArray[i], 200 + i * 20, 5, 20, 20));
}
}
this.draw = function () {
// renders the background
quadDisplay.draw();
// renders warp zones
JYCZone.zone();
dormZone.zone();
wilkensZone.zone();
libraryZone.zone();
// draws constructed character
player.draw();
// currently
player.move(keyCode);
// draws the sprites
for (s of sprites) {
s.draw();
}
// what allows for the props to change image
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 201) && (mouseX < 216)) {
player.image = propArray[0];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 219) && (mouseX < 237)) {
player.image = propArray[1];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 238) && (mouseX < 257)) {
player.image = propArray[2];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 261) && (mouseX < 277)) {
player.image = propArray[3];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 280) && (mouseX < 299)) {
player.image = propArray[4];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 300) && (mouseX < 316)) {
player.image = propArray[5];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 320) && (mouseX < 339)) {
player.image = propArray[6];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 342) && (mouseX < 355)) {
player.image = propArray[7];
}
if (mouseIsPressed && (mouseY < 24) && (mouseY > 3) && (mouseX > 361) && (mouseX < 376)) {
player.image = propArray[8];
}
// let mapOn = false;
// currently how warps are working
let jycDist = dist(player.x, player.y, JYCZone.x + JYCZone.size / 2, JYCZone.y + JYCZone.size / 2);
if (jycDist < 37) {
this.sceneManager.showScene(JYC);
// warps character near the entrance/exit
player.x = 950;
player.y = 925;
}
let dormDist = dist(player.x, player.y, dormZone.x + dormZone.size / 2, dormZone.y + dormZone.size / 2);
if (dormDist < 50) {
this.sceneManager.showScene(dorm);
// warps character near the entrance/exit
player.x = 320;
player.y = 500;
}
let libraryDist = dist(player.x, player.y, libraryZone.x + libraryZone.size / 2, libraryZone.y + libraryZone.size / 2);
if (libraryDist < 50) {
this.sceneManager.showScene(Library);
// warps character near the entrance/exit
player.x = 430;
player.y = 430;
}
let wilkensDist = dist(player.x, player.y, wilkensZone.x + wilkensZone.size / 2, wilkensZone.y + wilkensZone.size / 2);
if (wilkensDist < 50) {
this.sceneManager.showScene(wilkens);
// warps character near the entrance/exit
player.x = 300;
player.y = 520;
}
// minimap stuff
// if (keyIsPressed) {
// player.keyIsPressed(keyCode);
// if (keyCode === SHIFT) {
// mapOn = true;
// } else {
// mapOn = false;
// }
// }
// if (mapOn === true) {
// miniMap.draw();
// }
}
}
// create an array of all the pages
// then create a variable to keep track of what page you're on
// identify what areas on the map are 'transporation zones'
// when the sprite enters a transporation zone,
// alter the 'current' variable to match the corresponding map/page