-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·210 lines (172 loc) · 7.33 KB
/
index.html
File metadata and controls
executable file
·210 lines (172 loc) · 7.33 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
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
<html>
<head>
<title>BRAP</title>
<link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="lib/style.css">
<script type="application/javascript" src="vendor/jquery-2.1.4.min.js"></script>
</head>
<body>
<div id="welcome">
<div id="logo">
<span style="color:#3369E8">B</span>
<span style="color:#EEB211">R</span>
<span style="color:#D50F25">A</span>
<span style="color:#009925">P</span>
</div>
<div class="buttons">
<button type="button" id="play-btn">Play</button>
<button type="button" id="about-btn">BRAP?</button>
<button type="button" id="instructions-btn">Instructions</button>
<button type="button" id="observe-btn">Observe</button>
</div>
</div>
<div id="play">
<img src="http://i.imgur.com/u5RFgD6.jpg" class="img-responsive wasd">
<img src="http://i.imgur.com/3HhHfew.gif" class="img-responsive period">
<button type="button" class="back play">BACK</button>
</div>
<div id="about">
<h1>BRAP?</h1>
<p>
<br>
<br>
Think back to the classic game Asteroids. How can your ship move forever in your finite rectangular universe?
The vertical pair of edges and the horizontal pair of edges are effectively glued together.
If you think about it, gluing the horizontal edges and then gluing the vertical edges makes a doughnut or a torus.
In BRAP, you can get more than just a doughnut. In fact, you can get all 4 topological surfaces that can be defined with a rectangle and all 4096 possible universes! Every 15 seconds, the 'wrapping' will change. If you played for 17 hours straight,
you still might not BRAP in them all!
<br>
</p>
<button type="button" class="back">BACK</button>
</div>
<div id="instructions">
<h1>Instructions</h1>
<p>
You can move with 'W', 'A', 'S', 'D' and rotate your bumper clockwise with '.'
<br>
<img src="imgs/example_brap.jpg" class="img-responsive">
<br>
That little pink and purple thing... that's you! The task is simple, BRAP the gray ball as much and as fast as you can. BRAPping is bumping something with your purple bumper.
Be careful, though. Although your bumper is perfectly elastic, your pink section is vulnerable.
Remember, the faster you're going when you brap, the more points you'll get, but the crazier your BRAPing will become.
<br>
<br>
How do you know where you or the ball will be after passing through a wall? The colors will tell you. The large color of an edge identifies it. E.g., the left edge is the blue edge.
The small color tells you at which edge an object will reenter. E.g., in the image above, an object that exits through the left (blue) edge will reenter rom the right (red) edge. But there's a twist.
If there is a white triangle on the edge, then the object will reenter on the other edge on the other side and with a reflected velocity. E.g., if an object exited the blue edge 3/4 to the top, while moving left and upward,
it would renter on the red side 3/4 to the BOTTOM and moving left and UPWARD. This is what would happen in you twisted one of the edges before gluing them.
So, you'll have to think about where you'll be and where the gray ball will be after you BRAP.
<br>
<br>
Happy BRAPping!
</p>
<button type="button" class="back inst">BACK</button>
</div>
<div id="oberve">
<div id="size">
<div class="label">
size
</div>
<button type="button" id="subtract-size" class="subtract">-</button>
<button type="button" id="add-size" class="add">+</button>
</div>
<div id="num">
<div class="label">
number
</div>
<button type="button" id="subtract-num" class="subtract">-</button>
<button type="button" id="add-num" class="add">+</button>
</div>
<button type="button" class="back observe">BACK</button>
</div>
<canvas></canvas>
<script type="application/javascript" src="vendor/keymaster.js"></script>
<script type="application/javascript" src="lib/util.js"></script>
<script type="application/javascript" src="lib/movingObject.js"></script>
<script type="application/javascript" src="lib/asteroid.js"></script>
<script type="application/javascript" src="lib/ship.js"></script>
<script type="application/javascript" src="lib/bullet.js"></script>
<script type="application/javascript" src="lib/game.js"></script>
<script type="application/javascript" src="lib/gameView.js"></script>
<script type="application/javascript">
(function () {
$("#about").hide();
$("#instructions").hide();
$("#oberve").hide();
$("#play").hide();
var canvasEl = document.getElementsByTagName("canvas")[0];
canvasEl.width = 1500;
canvasEl.height = 620;
var ctx = canvasEl.getContext("2d");
var game = new Asteroids.Game(ctx);
new Asteroids.GameView(game, ctx).start();
game.observeMode(1700, 4);
$(".back").click(function (event) {
$('#welcome').show();
$(event.target).parent().hide();
});
$("#play-btn").click(function () {
$('#welcome').hide();
$('#play').show();
game.removeAll();
new Asteroids.GameView(game, ctx).start();
var ast = new Asteroids.Asteroid({ game: game, radius: 40 })
ast.pos = game.randomPosition();
ast.vel = Asteroids.Util.scale(ast.vel, .5);
game.asteroids.push(ast)
game.ships[0].score = 0;
game.ships[0].lives = 5;
game.wrapping = [[2,1], [3, 1], [0, 1], [1, 1]];
game.asteroids[0].vel = [0,0];
game.asteroids[0].pos = [1100, 310]
game.ships[0].pos = [165, 310];
game.ships[0].vel = [0, 0];
});
$("#about-btn").click(function () {
$('#welcome').hide();
$("#about").show();
});
$("#instructions-btn").click(function () {
$('#welcome').hide();
$("#instructions").show();
});
$("#observe-btn").click(function () {
$('#welcome').hide();
$("#oberve").show();
game.observeMode(1700, 4);
});
var radius = 7;
var number = 1700
$("#subtract-size").click(function () {
if (radius === 3.5) {
radius = 1;
};
if (radius === 1) {
radius = 4.5;
};
if (radius !== 1) {
game.observeMode(number, radius - 3.5);
radius -= 3.5
};
});
$("#add-size").click(function () {
if (number < 0) {
number = 1;
}
game.observeMode(number, radius + 3.5);
radius += 3.5
});
$("#subtract-num").click(function () {
number -= 75
game.observeMode(number, radius)
});
$("#add-num").click(function () {
number += 75
game.observeMode(number, radius);
});
})();
</script>
</body>
</html>