-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathexample.html
48 lines (37 loc) · 1.14 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Snake JS Example</title>
<script src="snake-js.js" type="text/javascript"></script>
<script type="text/javascript">
// If you are using jQuery, use < $(document).ready(function(){ ... }) > instead
document.addEventListener("DOMContentLoaded", function(){
// The DOM-element which will hold the playfield
// If you are using jQuery, you can use < var element = $("#parent"); > instead
var parentElement = document.getElementById("parent");
// User defined settings overrides default settings.
// See snake-js.js for all available options.
var settings = {
frameInterval : 120,
backgroundColor : "#f3e698"
};
// Create the game object. The settings object is NOT required.
// The parentElement however is required
var game = new SnakeJS(parentElement, settings);
}, true);
</script>
</head>
<body>
<h1>Snake JS Example</h1>
<div id="parent"></div>
<p>
<strong>Use the arrow keys to control the snake.</strong>
</p>
<p>
Made by <a href="http://betamos.se/">Didrik Nordström</a>.
<br />
For more information, see the <a href="../README.md">README file</a>.
</p>
</body>
</html>