init project

master
sundowndev 2017-12-08 20:41:28 +01:00
parent b23c5d5c8e
commit 9d86626f5f
3 changed files with 63 additions and 0 deletions

0
assets/css/style.css Normal file
View File

0
assets/js/script.js Normal file
View File

63
index.html Normal file
View File

@ -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>