/
canvas.html
57 lines (46 loc) · 1.74 KB
/
canvas.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
<html>
<head>
</head>
<body>
<canvas id = "canvas" height="400" width="800" style="border:1px solid #000000; margin-left: auto; margin-right:auto; margin-top:40px; display: block"></canvas>
<canvas id = "gameInfo" height="100" width="800" style="border: 1px solid #000000; margin-left:auto; margin-right: auto; margin-top: 25px; display: block"></canvas>
<script src="config.js"></script>
<script src="MouseTracker.js"></script>
<script src="Rectangle.js"></script>
<script src="Circle.js"></script>
<script src="Brick.js"></script>
<script src="Bat.js"></script>
<script src="Level.js"></script>
<script src="CollisionDetector.js"></script>
<script src="PointViewer.js"> </script>
<script src="Game.js"> </script>
<script src="EventHandler.js"></script>
<script>
var canvas = document.getElementById("canvas");
var infoCanvas = document.getElementById("gameInfo");
var ctx = canvas.getContext("2d");
var infoCtx = infoCanvas.getContext("2d");
var bat = new Bat();
var circle = new Circle();
bat.init( bat );
bat.setCoord( ( windowWidth - batLength ) / 2 , windowHeight - batHeight - 2 );
bat.setDim( batLength, batHeight );
bat.setColor( "green" );
circle = new Circle();
circle.init( circle );
circle.setRadius( circleRadius );
circle.setCenter( windowWidth/2 , windowHeight - batHeight - 2 - circle.radius );
circle.setSpeed( circleSpeed );
circle.setColor( "blue" );
circle.setDirection();
var game = new Game();
var pointViewer = new PointViewer();
game.setContext( ctx );
game.setInfoContext( infoCtx );
game.setBat( bat );
game.setCircle( circle );
game.setPointViewer( pointViewer );
game.startGame();
</script>
</body>
</html>