mirror of https://github.com/sundowndev/Detank.git
update
parent
9d86626f5f
commit
5446fb3e86
23
index.html
23
index.html
|
@ -22,7 +22,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="jeu"></div>
|
<div class="jeu"><canvas id="game"></canvas></div>
|
||||||
|
|
||||||
<script src="./assets/js/script.js"></script>
|
<script src="./assets/js/script.js"></script>
|
||||||
|
|
||||||
|
@ -37,27 +37,6 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
var game = document.getElementById("game");
|
var game = document.getElementById("game");
|
||||||
|
|
||||||
function startGame() {
|
|
||||||
myGamePiece = new component(30, 30, "red", 10, 120);
|
|
||||||
myGamePiece.gravity = 0.05;
|
|
||||||
myScore = new component("30px", "Consolas", "black", 280, 40, "text");
|
|
||||||
myGameArea.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
var myGameArea = {
|
|
||||||
canvas : document.createElement("canvas"),
|
|
||||||
start : function() {
|
|
||||||
this.canvas.width = 480;
|
|
||||||
this.canvas.height = 270;
|
|
||||||
this.context = this.canvas.getContext("2d");
|
|
||||||
document.body.insertBefore(this.canvas, document.body.childNodes[0]);
|
|
||||||
this.frameNo = 0;
|
|
||||||
},
|
|
||||||
clear : function() {
|
|
||||||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue