forked from jazzdan/CMPT120-Project-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Project v0.2.html
121 lines (99 loc) · 3.1 KB
/
Project v0.2.html
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
<!DOCTYPE html>
<html>
<!--Aaron Kippins
Project v0.2
Text Based Game-->
<head>
<meta charset="utf-8">
<title>Don't Worry Your To Blame</title>
<style>
h1{font-size:30pt; font-style:italic; font-family:times;}
body{background-color:Black; color:white;}
textarea{font-size:15pt; background-color:black; color:white; font-style:italic;}
</style>
<script type="text/javascript">
var score=0;
var hasVisitedNorth=false;
var hasVisitedWest=false;
var hasVisitedEast=false;
var hasVisitedSouth=false;
var currentLocation=0
function showscore(){
alert(score)
}
function movement(direction) {
if(direction === 1) {
//alert("Progress")
var msg = "You have moved north. You approach the desk to find a note.";
if(!hasVisitedNorth){
score=score+5;
hasVisitedNorth=true;
}
updatetext(msg);
} else if(direction === 2) {
var msg = "You have moved west. There is a wall here.";
if(!hasVisitedWest){
score=score+5;
hasVisitedWest=true;
}
updatetext(msg);
} else if(direction === 3) {
var msg = "You have moved east. There is a wall here.";
if(!hasVisitedEast){
score=score+5;
hasVisitedEast=true;
}
updatetext(msg);
} else if(direction === 4) {
var msg = "You have moved south. There is a wall here";
if(!hasVisitedSouth){
score=score+5;
hasVisitedSouth=true;
}
updatetext(msg);
}
}
/*you need to assign the message variable a string
Also don't forget the idea that you had about keeping
track of the player by using a grid with X&Y and setting
the coordinates to go through if else commands based on
the coordinates. Last Don't forget to take a break if you
get stuck */
function updatetext(msg){
var textarea = document.getElementById("tagame");
textarea.value = msg + "\n" + textarea.value;
}
</script>
</head>
<body>
<h1>
Welcome to Cerebro.
</h1>
<h2>
You're Gonna Be Here A While...
</h2>
<textarea id="tagame" name="Location" rows="4" cols="40">You wake up in a room with 4 walls and no door, you see a desk with a note on it. All that you have is a Compass.
</textarea>
<br>
<input type="button"
value="North"
onclick="movement(1);">
<br>
<input type="button"
value="West"
onclick="movement(2);">
<input type="button"
value="East"
onclick="movement(3)">
<br>
<input type="button"
value="South"
onclick="movement(4);">
<br>
<input type="button"
value="Score"
onclick="showscore();">
<br>
<a href="mailto:[email protected]">Need Help?</a>
</body>
</html>