-
Notifications
You must be signed in to change notification settings - Fork 1
/
classes.js
211 lines (153 loc) · 3.42 KB
/
classes.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
//Classes.js includes all shared classes for Comma Quest scenes
class smileyFace {
constructor(xpos,ypos, radius) {
this.radius = 25;
this.x = xpos;
this.y = ypos;
this.leftEye = false;
this.rightEye = false;
this.mouth = false;
this.upsideDownMouth = false;
this.nose = false;
}
halo() {
fill(color(255,255,255,.4))
circle(this.x,this.y,this.radius +35)
}
move(rad,face) {
face.x = mouseX;
face.y = mouseY;
face.radius = rad;
}
display(rad) {
if(rad!= null){
this.radius = rad;
}
noCursor();
textFont('Caveat Brush');
fill(255);
noStroke();
circle(this.x,this.y,this.radius);
if(this.radius > 20) {
beginShape();
angleMode(RADIANS);
for(var i = 0; i < TWO_PI ; i+= .1) {
let xOff = map(noise(i) * sin(i*4),-1,1,-5,5);
let yOff = map(noise(i) * sin(i*4),-1,1,-5,5);
let x = this.x +xOff + (this.radius -23) * cos(i);
let y = this.y +yOff + (this.radius - 23) * sin(i );
vertex(x, y);
}
endShape();
}
if (this.leftEye) {
noStroke();
fill(0);
var leftX = (this.x - (.3*this.radius));
var leftY= (this.y - (.08*this.radius));
drawPunct(".",this.radius/2.5,leftX,leftY,20)
//circle(leftX,leftY,this.radius/30);
}
if (this.rightEye) {
noStroke();
fill(0);
var rightX =(this.x + (.3*this.radius));
var rightY=(this.y - (.08*this.radius));
drawPunct(".",this.radius/2.5,rightX,rightY,20)
}
if(this.mouth) {
noFill();
stroke(0);
arc(this.x, this.y + .12*this.radius, 1.5*(leftX-this.x),this.radius/3 ,0, PI);
//inverse mouth
}
if(this.upsideDownMouth) {
noFill();
stroke(0);
arc(this.x, this.y + .3*this.radius, 1.5*(leftX-this.x),this.radius/3,PI, TWO_PI);
}
if(this.nose) {
drawPunct("[",this.radius/2.5,this.x - (.05*this.radius),(this.y +(.02*this.radius)) ,20);
drawPunct("] ",this.radius/2.5,this.x + (.05*this.radius),(this.y + (.02*this.radius)),20)
}
}
inverseDisplay(rad){
if(rad!= null){
this.radius = rad;
}
noCursor();
if(displayCheck(this)){
fill(255);
push()
translate(this.x, this.y);
var oldX = this.x;
var oldY = this.y;
rotate(PI);
this.x = 0;
this.y = 0;
this.display(rad);
pop();
this.x = oldX;
this.y = oldY;
}
}
}
class screen {
constructor() {
}
display() {
//setup text styles for Punctuation Calls
textAlign(CENTER);
var textBoxSize= 500;
textSize(24);
fill(0);
//draw the horizon line
//text-dependent on case:
switch (drawCase) {
case 0:
//Statements executed when the
//result of expression matches value1
sceneZero();
break;
case 1:
//Statements executed when the
//result of expression matches value2
sceneOne();
break;
case 2:
//Statements executed when the
//result of expression matches valueN
sceneTwo();
break;
case 3:
sceneThree();
break;
}
//Sets up text-styles for the text calls
textSize(18);
noStroke();
fill(0);
textAlign(LEFT);
//Text will be drawn this far from the bottom
var marginBottom = windowHeight/8;
//text-dependent on case:
textFont("Stoke");
switch (textCase) {
case 0:
//Statements executed when the
//result of expression matches value1
text("You wake up. You remember nothing. You are in a field and the field goes on forever. You begin to walk.",sceneMargin, marginBottom,sceneWidth);
break;
case 1:
//Statements executed when the
//result of expression matches value2
text("You reach a forest. There are tall trees and on them, a rich dark fruit. You remember hunger. ",sceneMargin, marginBottom,sceneWidth);
break;
case 2:
//Statements executed when the
//result of expression matches valueN
text("This is case 3",windowWidth/2 - textBoxSize/2, marginBottom,textBoxSize);
break;
}
}
}