Update JavaScript
This commit is contained in:
parent
d4495e4189
commit
ae9a226bb9
25
Script.js
25
Script.js
@ -14,5 +14,28 @@ function init() {
|
|||||||
ctx = c.getContext('2d');
|
ctx = c.getContext('2d');
|
||||||
document.addEventListener('keydown', keyDownPressed, false);
|
document.addEventListener('keydown', keyDownPressed, false);
|
||||||
document.addEventListener('keyup', keyUpPressed, false);
|
document.addEventListener('keyup', keyUpPressed, false);
|
||||||
gameloop();
|
gameLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyDownPressed(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyDownPressed(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearGame(){
|
||||||
|
ctx.save();
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.fillReact(100, 100, 100, 100);
|
||||||
|
ctx.fill();
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
function gameLoop(timestamp){
|
||||||
|
clearGame();
|
||||||
|
updateGame();
|
||||||
|
drawGame();
|
||||||
|
window.requestAnimationFrame(gameLoop);
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user