var screen, input, frames;
var alSprite, taSprite, ciSprite;
var aliens, dir, tank, bullets, cities;
function main () {
screen = new Screen(510, 600);
input = new InputHandler();
var img = new Image();
img.addEventListener("load", function(){
alSprite = [
[new Sprite(this, 10, 10, 22, 15), new Sprite(this, 0, 16, 22, 16)],
[new Sprite(this, 22, 16, 15), new Sprite(this, 22, 15, 16, 16)],
[new Sprite(this, 38, 0, 24, 16), new Sprite(this, 38, 16, 24, 16)]
];
taSprite = new Sprite(this);
ciSprite = new Sprite(this);
init();
run();
});
img.src = "res/invaders.png";
};
function init() {};
function run() {
var loop = function(){
update();
render();
window.requestAnimationFrame(loop, screen.canvas);
};
};
function update() {};
function render() {
screen.drawSprite(alSp[0][0], 10, 10);
};
canvas{
background-color: #000;
display: block;
position: absolute;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0
}
<!DOCTYPE html>
<html>
<head>
<script src="js/helper.js"></script>
<title></title>
</head>
<body onload="main()">
</body>
</html>