-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_solution.js
264 lines (200 loc) · 5.48 KB
/
my_solution.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// I worked on this challenge by myself!
// For each mission, write the title as a comment. (Shown here). Also include pseudocode as a comment.
// Note: to make commenting easier, you can highlight the section you want to comment and hold
// command + / This will comment the line.
// Mission 1: Rescue Mission
// move down x2
// move right
// move up x2
// move right x2
// move down
// ATTACK!!!
this.moveDown();
this.moveDown();
this.moveRight();
this.moveUp();
this.moveUp();
this.moveRight();
this.moveRight();
this.moveDown();
this.attackNearbyEnemy();
// Mission 2: Grab The Mushroom
// move up
// move right
// move left
// move up
// ATTACK!!!
this.moveUp();
this.moveRight();
this.moveLeft();
this.moveUp();
this.attackNearbyEnemy();
// Mission 3: Drink Me
// move right
// attack
// move right
// move down
// move up
// move right
// ATTACK!!!
this.moveRight();
this.attackNearbyEnemy();
this.moveRight();
this.moveDown();
this.moveUp();
this.moveRight();
this.attackNearbyEnemy();
// Mission 4: Taunt The Guards
// bust down door:
// move right
// bust down door
// kill all guards
// move right
// say "Hey there!"
// move left
// move left
// say "ATTACK!!!"
// get Phoebe to follow you throught the dungeon
// move right
// say "Follow me!"
// move right x2
// move up
// move right
// say "What's Up!"
// move down
// move right
// move up
// move right x2
this.moveRight();
this.bustDownDoor();
// Delete the "//" in front of each line below.
this.moveRight();
this.say("Hey there!");
this.moveLeft();
this.moveLeft();
this.say("Attack!");
//Get Phoebe to follow you through the dungeon
this.moveRight();
this.say("Follow me.");
this.moveRight();
this.moveRight();
this.moveUp();
this.moveRight();
this.say("What's up?");
this.moveDown();
this.moveLeft();
this.moveUp();
this.moveRight();
this.moveRight();
// Mission 5: IT'S A TRAP!!!
// move down x2
// say "Hello!"
// move up x2
this.moveDown();
this.moveDown();
this.say("Hello!");
this.moveUp();
this.moveUp();
// Mission 6: Break Into The Prison!"
// Phoebe is friend
// Gordon is friend
// Lucas is friend
// Marcus is friend
// Robert is friend
// William is friend
// Brack is not friend
// Gort is not friend
// Grul 'Thock is not friend
// Krogg is not friend
// Write this isFriend(name) spell to tell friend from foe.
// Return true for friends' names, false for ogres' names.
if(name === "William")
return true;
if(name === "Krogg")
return false;
if(name ==="Lucas")
return true;
if(name==="Marcus")
return true;
if(name==="Robert")
return true;
if(name==="William")
return true;
if(name==="Gordon")
return true;
if(name==="Brack")
return false;
if(name==="Gort")
return false;
if(name==="Grul 'Thock")
return false;
if(name==="Krogg")
return false;
// Mission 7: Taunt:
// say something x4
this.say("Hey!");
// Lure the ogre right into your arrow trap
// By saying something to him
// Anything works!
this.say("What's up?");
this.say("Come on over!");
this.say("Yes");
// Mission 8: Cowardly Taunt:
// move to a place where most ogres can hear you
// say anything
// RUN!!
this.moveXY(50, 27);
this.say("What's up");
this.moveXY(63, 20);
this.moveXY(70, 10); // This is a safe spot.
this.say("I can lure them in here.");
// move to where the ogres can hear you
// ay something!
// hide behind the towers
// Mission 9: Commanding Followers:
// move over to soldiers
// make them follow you
// move over to ogres
// make soldiers kill ogres
this.moveXY(60, 63);
this.say("Follow me!");
this.moveXY(64, 44);
this.say("Attack!");
// saying something with "follow" in it will get nearby soldiers
// to follow you
// Saying something with "attack" will make nearby soldiers attack
// Make sure Tharin is safe!
//Mission 10: Mobile Artillery
// move over to ogres 1
// kill all ogres 1
// move over to ogres 2
// kill all ogres 2 x2
// move over to ogres 3
// kill all gores x2
this.moveXY(30, 26);
this.attackXY(46, 5);
this.moveXY(57, 32);
this.attackXY(67, 50);
this.attackXY(63, 44);
this.moveXY(47, 42);
this.attackXY(47, 62);
this.attackXY(47, 50);
// Utilizing the numbers above will aid in the destruction of your enemies
// Each attack is ranged, so the closer you are the stronger the attack
//Some attacks land right in the middle of the group!!
//Release 3: Answer the following questions
//When you are finished with all of the campaigns, answer the following questions. You may want to look at some resources on JavaScript before answering.
//What is this referring to? Think programming-wise rather than in the terms of the game.
//In JavaScript, "this" is in reference to the object in which the program is going to be attributed to.
//What does the () do in JavaScript?
//The brackets or parenthesis are used as an encapsulation mechnism when you enter a function or a variable or a method
//What is the point of the semicolons?
//The nifty semicolon means that is the end of the statement, and are moving on to another string in the method
//Release 4: Reflect
// Reflection:
// Write your reflection here.
//While this was a doozy in some spots (i don't know if it was my computer or what but I kept having issues') It was fun!
//Javascript is NOT as easy as most people claim it to be as a matter of fact it is the opposite at least for me.
//This challenge was really cool and being able to sit here and actually go through what each action was for
// I think that's nice to break things down so that you understand them better.
//all and all, it was a fun thing to do