Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (33 sloc) 1.079 kb
class Title {
HTMLCanvasElement canvas;
CanvasRenderingContext2D ctx;
HTMLImageElement img;
HTMLAudioElement audio;
Title(){
canvas = window.document.getElementById('canvas');
ctx = canvas.getContext('2d');
img = window.document.createElement('img');
img.src = "images/intro.png";
img.onload = (e){
ctx.drawImage(img, 0 , 0);
canvas.onmousedown = clickListener;
audio = window.document.createElement('audio');
audio.loop = true;
audio.src = 'sounds/background.mp3';
audio.autoplay = true;
};
}
void clickListener(MouseEvent e){
if(e.offsetX >= 152 && e.offsetX <= (152+183) && e.offsetY >= 540 && e.offsetY <= (540+89)){
ctx.clearRect(0,0,canvas.width, canvas.height);
canvas.onmousedown = (e){};
audio.pause();
new Game();
}
else if(e.offsetX >= 442 && e.offsetX <= (442+186) && e.offsetY >= 529 && e.offsetY <= (529+116)){
ctx.clearRect(0,0,canvas.width, canvas.height);
new Introduction(audio);
canvas.onmousedown = (e){};
}
}
}
Jump to Line
Something went wrong with that request. Please try again.