sauvegarde avant nouvelle classe
This commit is contained in:
parent
fe05cb52bf
commit
30eb5c26d5
@ -8,14 +8,19 @@
|
||||
border: 1px solid #d3d3d3;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onload="startGame()">
|
||||
<h1 class="center">Fuyez l'homme en noir !</h1>
|
||||
<script src="./script.js"></script>
|
||||
|
||||
<br>
|
||||
<button onmousedown="sauter(-0.5)" onmouseup="sauter(0.05)">SAUTER</button>
|
||||
<p>Fuyez l'homme en noir !</p>
|
||||
<button onmousedown="sauter(-0.5)" onmouseup="sauter(0.05)" class="center">SAUTER</button>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,20 +1,15 @@
|
||||
//VARIABLES
|
||||
var personnage;
|
||||
var obstacle = [];
|
||||
var score;
|
||||
|
||||
function startGame() {
|
||||
personnage = new component(30, 30, "red", 10, 120);
|
||||
personnage.gravity = 0.05;
|
||||
score = new component("30px", "Consolas", "black", 280, 40, "text");
|
||||
plateau.start();
|
||||
}
|
||||
|
||||
var plateau = {
|
||||
canvas: document.createElement("canvas"),
|
||||
start: function() {
|
||||
this.canvas.width = 480;
|
||||
this.canvas.height = 270;
|
||||
this.context = this.canvas.getContext("2d");
|
||||
this.canvas.style = "position:absolute; left: 50%; width: 400px; margin-left: -200px;";
|
||||
document.body.insertBefore(this.canvas, document.body.childNodes[0]);
|
||||
this.frameNo = 0;
|
||||
this.interval = setInterval(updateGameArea, 20);
|
||||
@ -24,6 +19,14 @@ var plateau = {
|
||||
}
|
||||
}
|
||||
|
||||
//METHODES
|
||||
function startGame() {
|
||||
personnage = new component(30, 30, "red", 10, 120);
|
||||
personnage.gravity = 0.05;
|
||||
score = new component("30px", "Consolas", "black", 280, 40, "text");
|
||||
plateau.start();
|
||||
}
|
||||
|
||||
function component(largeur, longueur, color, x, y, type) {
|
||||
this.type = type;
|
||||
this.score = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user