Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions scripts/levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ var v8 = 0.73;
var v10= 1.26;var v11= 0.3937;var v12= 0.3937;var v13= 1.26;
var v21= 1.2; var v22= 1.2;
var ss = [];

var explosion = new Audio('sounds/mothershipExplosion.mp3');
var enemyExplosion = new Audio('sounds/enemyExplosion.mp3');
var burning = new Audio('sounds/burning2.mp3');

function initialiseLevel()
{
Expand Down Expand Up @@ -1421,6 +1423,7 @@ function Level()
for(var i = 0;i<ss.length;i++){
if(ss[i].fh <= 0)
{
explosion.play()
lives--;
if(lives != 0)
{
Expand All @@ -1440,9 +1443,40 @@ function Level()
}
}
}

if(eh <= 95) {
burning.play();
gameArena.drawImage(enemyShipBurning, ex, ey, 120*(width/1220), 114.43*(width/1220));

setTimeout(function(){
gameArena.drawImage(enemyShipBurning, ex, ey, 120*(width/1220), 114.43*(width/1220));
}, 1000);

setTimeout(function(){
gameArena.drawImage(enemyShipBurning2, ex, ey, 120*(width/1220), 114.43*(width/1220));
}, 1000);

setTimeout(function(){
gameArena.drawImage(enemyShipBurning3, ex, ey, 120*(width/1220), 114.43*(width/1220));
}, 1000);

setTimeout(function(){
gameArena.drawImage(enemyShipBurning4, ex, ey, 120*(width/1220), 114.43*(width/1220));
}, 1000);


}

if(eh <= 0)
enemyDestroyed = true;

if(enemyDestroyed === true) {
enemyExplosion.play();
setTimeout(function(){
gameArena.drawImage(enemyShipExplosion, ex, ey, 120*(width/1220), 114.43*(width/1220));
}, 1000);
}

if(runtime%40 == 0)
{
seconds++;
Expand Down Expand Up @@ -2194,7 +2228,7 @@ function Level_gameOver()
runtime = 0;
init = false;
clearInterval(gameTimer);
for(var i = 0;i < mirrorCount;i++)
for(var i = 0; i < mirrorCount; i++)
{
mirrorDrag[i] = false;
canvas.removeEventListener("mousemove", Level_mousemove);
Expand All @@ -2207,6 +2241,7 @@ function Level_gameOver()
gameArena.font = "40px Zorque";
gameArena.fillStyle = "#E6FFFF";
gameArena.fillText("Game Over!", midx, midy-30*(width/1220));

gameTimer = setInterval(drawLevelGO, gameSpeed);
}

Expand Down
13 changes: 13 additions & 0 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ enemyShip.onload = function() {
}
enemyShip.src = "sprites/spacestation2.png";

var enemyShipBurning = new Image();
var enemyShipBurning2 = new Image();
var enemyShipBurning3 = new Image();
var enemyShipBurning4 = new Image();
var enemyShipExplosion = new Image();

enemyShipBurning.src = "sprites/spacestationBurning.png"
enemyShipBurning2.src = "sprites/spacestationBurning2.png"
enemyShipBurning3.src = "sprites/spacestationBurning3.png"
enemyShipBurning4.src = "sprites/spacestationBurning4.png"
enemyShipExplosion.src = "sprites/spacestationExplosion.jpg"


var secondShip = new Image();
secondShip.onload = function() {
loading++;
Expand Down
Binary file added sounds/burning.mp3
Binary file not shown.
Binary file added sounds/burning2.mp3
Binary file not shown.
Binary file added sounds/enemyExplosion.mp3
Binary file not shown.
Binary file added sounds/mothershipExplosion.mp3
Binary file not shown.
Binary file added sprites/spacestationBurning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites/spacestationBurning2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites/spacestationBurning3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites/spacestationBurning4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites/spacestationExplosion.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.