-
Notifications
You must be signed in to change notification settings - Fork 1
/
artattack.htm
91 lines (80 loc) · 2.61 KB
/
artattack.htm
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
<html lang="en">
<head>
<meta charset="utf-8">
<!--
default-src 'none';
style-src 'self';
-->
<meta http-equiv="content-security-policy" content="
base-uri 'self';
child-src blob:;
frame-src blob:;
connect-src https://api.stackexchange.com;
script-src 'self' 'unsafe-inline' blob:;
worker-src blob:;
img-src 'self';
form-action 'none';
">
<!-- these properties are read by the engine to configure the game -->
<title>Art Attack</title>
<link rel="icon" href="favicons/artattack.png"> <!-- don't forget a favicon! -->
<meta name="stack-exchange-site" content="codegolf">
<meta name="stack-exchange-qid" content="170908"> <!-- question ID here -->
<!-- Defines extra columns which appear in the entry selection pane of the code editor -->
<meta name="team-view-columns" content='[]'>
<!-- team selection configuration - pick a filename from /teams
(free_for_all = all entries on their own team) -->
<meta name="team-type" content="free_for_all">
<meta name="team-type-args" content='{}'>
<!-- tournament configuration - pick a filename from /matches -->
<meta name="tournament-type" content="brawl">
<meta name="tournament-type-args" content='{}'>
<!-- match configuration - pick a filename from /matches -->
<meta name="match-type" content="brawl">
<meta name="match-type-args" content='{
"count": 50
}'>
<meta name="game-type" content="artattack"> <!-- put your /games/<folder_name> here -->
<meta name="game-config" content='{
"maxFrame": 2000
}'> <!-- put any default gameConfig stuff here -->
<meta name="play-config" content='{
"delay": 0,
"speed": 1
}'> <!-- pick a reasonable default playspeed (should be fast but watchable) -->
<meta name="display-config" content='{}'> <!-- put any default displayConfig stuff here -->
<!-- fill in this template to help people get started with their entries -->
<meta name="default-code" content="function(myself, grid, bots, gameInfo) {
// Code here
return 'up';
}
">
<script src="core/requirejs.js"></script>
<script src="engine/entry.js" async></script>
</head>
<body>
<noscript>This viewer requires Javascript!</noscript>
<script>
var kbdmap = {
1: 'Play 1/4 Speed',
2: 'Play 1/2 Speed',
3: 'Play',
4: 'Play Fast',
5: 'Fastest Possible',
' ': 'Pause',
'`': 'Step'
}
var shorcutFn = function (e) {
var active = document.activeElement.tagName.toLowerCase();
if (active === 'input' || active === 'textarea' || e.shiftKey || e.ctrlKey || e.altKey) return;
let k = e.key;
let name = kbdmap[k];
if (name) {
document.querySelector(`button[title="${name}"]`).click();
e.preventDefault();
}
};
document.addEventListener("keydown", shorcutFn);
</script>
</body>
</html>