-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDreshta-snake.html
35 lines (28 loc) · 992 Bytes
/
Dreshta-snake.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
<!DOCTYPE html>
<html>
<head>
<title>The legend of basilisk the snake</title>
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
<script src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;
var blockSize = 10;
var widthInBlocks = width / blockSize;
var heightInBlocks = height / blockSize;
var score = 0;
var drawBorder = function() {
ctx.fillStyle = "DarkTurquoise";
ctx.fillRect(0, 0, width, blockSize);
ctx.fillRect(0, blockSize, blockSize, height - blockSize);
ctx.fillRect(height - blockSize, blockSize, blockSize, height);
ctx.fillRect(blockSize, width - blockSize, width - blockSize * 2, blockSize);
};
drawBorder();
</script>
</body>
</html>