mirror of https://github.com/sundowndev/Detank.git
init project
parent
b23c5d5c8e
commit
9d86626f5f
|
@ -0,0 +1,63 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tank Breaker</title>
|
||||
<link rel="stylesheet" href="./assets/css/style.css">
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
div.jeu {
|
||||
width: 1170px;
|
||||
height: 658px;
|
||||
}
|
||||
|
||||
canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #eee;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="jeu"></div>
|
||||
|
||||
<script src="./assets/js/script.js"></script>
|
||||
|
||||
<script>
|
||||
var keys = {
|
||||
'player1': ['z','q','s','d'],
|
||||
'player2': ['ArrowUp','ArrowLeft','ArrowDown','ArrowRight']
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", function(e){
|
||||
console.log(e.key);
|
||||
});
|
||||
|
||||
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>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue