Update JS
This commit is contained in:
parent
ae9a226bb9
commit
6d84240c67
36
Script.js
36
Script.js
@ -5,6 +5,14 @@ var canvasHeight = 650;
|
|||||||
var c = undefined
|
var c = undefined
|
||||||
var ctx = undefined
|
var ctx = undefined
|
||||||
|
|
||||||
|
var game = {
|
||||||
|
level: 1,
|
||||||
|
speed: 1,
|
||||||
|
gameOver: false,
|
||||||
|
frames: 0,
|
||||||
|
timer: 0,
|
||||||
|
}
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
@ -21,21 +29,27 @@ function keyDownPressed(e){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyDownPressed(e){
|
function keyUpPressed(e){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearGame(){
|
function clearGame() {
|
||||||
ctx.save();
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
||||||
ctx.fillStyle = 'white';
|
}
|
||||||
ctx.fillReact(100, 100, 100, 100);
|
|
||||||
ctx.fill();
|
function updateGame() {
|
||||||
ctx.restore();
|
|
||||||
|
|
||||||
|
game.frames++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawGame() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gameLoop(timestamp){
|
function gameLoop(timestamp){
|
||||||
clearGame();
|
clearGame();
|
||||||
updateGame();
|
updateGame();
|
||||||
drawGame();
|
drawGame();
|
||||||
window.requestAnimationFrame(gameLoop);
|
window.requestAnimationFrame(gameLoop);
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user