/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
leaderboard: []
});
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 15;
self.lifetime = 0;
self.maxLifetime = 150;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
if (self.lifetime > self.maxLifetime) {
self.destroy();
}
};
return self;
});
var EnemyBasic = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
enemyGraphics.tint = 0xff3333;
self.velocityX = 0;
self.velocityY = 0;
self.speed = 2;
self.health = 1;
self.enemyType = 'crab';
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var EnemyTough = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy2', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 1.5;
self.health = 2;
self.enemyType = 'spongebob';
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.lifetime = 0;
self.maxLifetime = 40;
self.color = 0xffff00;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
var alpha = 1 - self.lifetime / self.maxLifetime;
particleGraphics.alpha = alpha;
if (self.lifetime > self.maxLifetime) {
self.destroy();
}
};
return self;
});
var PlayerShip = Container.expand(function () {
var self = Container.call(this);
var shipGraphics = self.attachAsset('playerShip', {
anchorX: 0.5,
anchorY: 0.5
});
shipGraphics.rotation = -Math.PI / 2;
self.velocityX = 0;
self.velocityY = 0;
self.acceleration = 0.8;
self.friction = 0.92;
self.maxSpeed = 8;
self.rotation = 0;
self.health = 5;
self.canShoot = true;
self.shootCooldown = 0;
self.shieldActive = false;
self.shieldDuration = 0;
self.shieldMaxDuration = 120;
self.shieldGraphic = null;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityX *= self.friction;
self.velocityY *= self.friction;
var speed = Math.sqrt(self.velocityX * self.velocityX + self.velocityY * self.velocityY);
if (speed > self.maxSpeed) {
var ratio = self.maxSpeed / speed;
self.velocityX *= ratio;
self.velocityY *= ratio;
}
if (self.x < 40) self.x = 40;
if (self.x > 2008) self.x = 2008;
if (self.y < 40) self.y = 40;
if (self.y > 2692) self.y = 2692;
shipGraphics.rotation = self.rotation + Math.PI / 2;
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
if (self.shieldActive) {
self.shieldDuration++;
if (!self.shieldGraphic) {
self.shieldGraphic = self.addChild(new Shield());
}
if (self.shieldDuration >= self.shieldMaxDuration) {
self.shieldActive = false;
self.shieldDuration = 0;
if (self.shieldGraphic) {
self.shieldGraphic.destroy();
self.shieldGraphic = null;
}
}
}
};
return self;
});
var Shield = Container.expand(function () {
var self = Container.call(this);
var shieldRing = LK.getAsset('shieldCircle', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChild(shieldRing);
shieldRing.width = 280;
shieldRing.height = 280;
shieldRing.tint = 0xFFD700;
shieldRing.alpha = 0.6;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x001a4d
});
/****
* Game Code
****/
var playerShip = game.addChild(new PlayerShip());
playerShip.x = 1024;
playerShip.y = 1366;
var enemies = [];
var bullets = [];
var particles = [];
var coins = 0;
var health = 5;
var spawnRate = 60;
var spawnCounter = 0;
var shieldAbilityAvailable = true;
var lastShieldCoinThreshold = 0;
var lastAutomaticShieldCoins = 0;
var coinsTxt = new Text2('Coins: 0', {
size: 100,
fill: 0xFFD700
});
coinsTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(coinsTxt);
var healthHearts = [];
for (var h = 0; h < 5; h++) {
var heart = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
healthHearts.push(heart);
LK.gui.topLeft.addChild(heart);
}
for (var h = 0; h < healthHearts.length; h++) {
healthHearts[h].x = 60 + h * 50;
healthHearts[h].y = 50;
}
var keysPressed = {
w: false,
a: false,
s: false,
d: false
};
var mouseX = 1024;
var mouseY = 1366;
function createParticleExplosion(x, y) {
var bubbleCount = 5;
for (var i = 0; i < bubbleCount; i++) {
var particle = game.addChild(new Particle());
particle.x = x;
particle.y = y;
var angle = i / bubbleCount * Math.PI * 2;
var speed = 2.5 + Math.random() * 1.5;
particle.velocityX = Math.cos(angle) * speed;
particle.velocityY = Math.sin(angle) * speed;
var bubbleColors = [0x00ccff, 0x0099ff, 0x66ddff, 0x33bbff];
particle.color = bubbleColors[Math.floor(Math.random() * bubbleColors.length)];
particle.children[0].tint = particle.color;
particles.push(particle);
}
LK.getSound('explosion').play();
}
function spawnEnemy() {
var rand = Math.random();
var enemyType = rand < 0.5 ? 'basic' : 'tough';
var enemy = game.addChild(enemyType === 'basic' ? new EnemyBasic() : new EnemyTough());
var side = Math.floor(Math.random() * 4);
if (side === 0) {
enemy.x = Math.random() * 2048;
enemy.y = -30;
} else if (side === 1) {
enemy.x = 2048 + 30;
enemy.y = Math.random() * 2732;
} else if (side === 2) {
enemy.x = Math.random() * 2048;
enemy.y = 2732 + 30;
} else {
enemy.x = -30;
enemy.y = Math.random() * 2732;
}
var dx = playerShip.x - enemy.x;
var dy = playerShip.y - enemy.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
enemy.velocityX = dx / distance * enemy.speed;
enemy.velocityY = dy / distance * enemy.speed;
}
enemies.push(enemy);
}
game.move = function (x, y, obj) {
mouseX = x;
mouseY = y;
var dx = mouseX - playerShip.x;
var dy = mouseY - playerShip.y;
playerShip.rotation = Math.atan2(dy, dx);
};
game.down = function (x, y, obj) {
if (playerShip.shootCooldown <= 0) {
var bullet = game.addChild(new Bullet());
bullet.x = playerShip.x;
bullet.y = playerShip.y;
bullet.velocityX = Math.cos(playerShip.rotation) * bullet.speed;
bullet.velocityY = Math.sin(playerShip.rotation) * bullet.speed;
var bulletGraphics = bullet.children[0];
tween(bulletGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
easing: tween.easeOut
});
bullets.push(bullet);
playerShip.shootCooldown = 8;
LK.getSound('shoot').play();
}
};
var keyboardHandler = function keyboardHandler(e) {
if ((e.key === 'e' || e.key === 'E') && shieldAbilityAvailable && coins >= 100) {
playerShip.shieldActive = true;
playerShip.shieldDuration = 0;
coins -= 100;
coinsTxt.setText('Coins: ' + coins);
shieldAbilityAvailable = false;
lastShieldCoinThreshold = coins;
}
};
game.on('keydown', keyboardHandler);
game.update = function () {
spawnCounter++;
if (spawnCounter > spawnRate) {
spawnEnemy();
spawnCounter = 0;
if (spawnRate > 15) {
spawnRate = Math.max(15, 60 - Math.floor(coins / 5));
}
}
if (keysPressed.w) {
playerShip.velocityX += Math.cos(playerShip.rotation) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation) * playerShip.acceleration;
}
if (keysPressed.a) {
playerShip.velocityX += Math.cos(playerShip.rotation - Math.PI / 2) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation - Math.PI / 2) * playerShip.acceleration;
}
if (keysPressed.s) {
playerShip.velocityX += Math.cos(playerShip.rotation + Math.PI) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation + Math.PI) * playerShip.acceleration;
}
if (keysPressed.d) {
playerShip.velocityX += Math.cos(playerShip.rotation + Math.PI / 2) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation + Math.PI / 2) * playerShip.acceleration;
}
for (var b = bullets.length - 1; b >= 0; b--) {
var bullet = bullets[b];
if (bullet.lifetime === undefined) bullet.lifetime = 0;
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
for (var e = enemies.length - 1; e >= 0; e--) {
var enemy = enemies[e];
if (bullet.intersects(enemy)) {
enemy.health--;
if (enemy.health <= 0) {
createParticleExplosion(enemy.x, enemy.y);
coins += 10;
coinsTxt.setText('Coins: ' + coins);
enemy.destroy();
enemies.splice(e, 1);
} else {
var enemyGraphics = enemy.children[0];
enemyGraphics.tint = 0xcccccc;
}
bullet.destroy();
bullets.splice(b, 1);
break;
}
}
}
if (coins >= lastShieldCoinThreshold + 100) {
shieldAbilityAvailable = true;
}
if (coins >= lastAutomaticShieldCoins + 200) {
playerShip.shieldActive = true;
playerShip.shieldDuration = 0;
lastAutomaticShieldCoins = coins;
if (playerShip.shieldGraphic) {
playerShip.shieldGraphic.destroy();
playerShip.shieldGraphic = null;
}
playerShip.shieldGraphic = playerShip.addChild(new Shield());
}
for (var e = enemies.length - 1; e >= 0; e--) {
var enemy = enemies[e];
if (enemy.lastIntersecting === undefined) enemy.lastIntersecting = false;
var currentIntersecting = enemy.intersects(playerShip);
if (!enemy.lastIntersecting && currentIntersecting) {
if (playerShip.shieldActive) {
createParticleExplosion(enemy.x, enemy.y);
coins += 10;
coinsTxt.setText('Coins: ' + coins);
enemy.destroy();
enemies.splice(e, 1);
} else {
var damageAmount = enemy.enemyType === 'crab' ? 0.5 : 1;
health -= damageAmount;
playerShip.health = health;
for (var hIdx = 0; hIdx < healthHearts.length; hIdx++) {
if (hIdx < Math.floor(health)) {
healthHearts[hIdx].alpha = 1;
} else if (hIdx === Math.floor(health) && health % 1 !== 0) {
healthHearts[hIdx].alpha = 0.5;
} else {
healthHearts[hIdx].alpha = 0.3;
}
}
createParticleExplosion(enemy.x, enemy.y);
enemy.destroy();
enemies.splice(e, 1);
if (health <= 0) {
var leaderboardData = storage.leaderboard || [];
leaderboardData.push(coins);
leaderboardData.sort(function (a, b) {
return b - a;
});
if (leaderboardData.length > 10) {
leaderboardData = leaderboardData.slice(0, 10);
}
storage.leaderboard = leaderboardData;
LK.showGameOver();
}
LK.effects.flashObject(playerShip, 0xff0000, 300);
}
}
enemy.lastIntersecting = currentIntersecting;
if (enemy.x < -100 || enemy.x > 2148 || enemy.y < -100 || enemy.y > 2832) {
enemy.destroy();
enemies.splice(e, 1);
}
}
for (var p = particles.length - 1; p >= 0; p--) {
var particle = particles[p];
if (particle.lifetime > particle.maxLifetime) {
particle.destroy();
particles.splice(p, 1);
}
}
};
LK.playMusic('bgmusic', {
loop: true
}); /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
leaderboard: []
});
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 15;
self.lifetime = 0;
self.maxLifetime = 150;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
if (self.lifetime > self.maxLifetime) {
self.destroy();
}
};
return self;
});
var EnemyBasic = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
enemyGraphics.tint = 0xff3333;
self.velocityX = 0;
self.velocityY = 0;
self.speed = 2;
self.health = 1;
self.enemyType = 'crab';
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var EnemyTough = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy2', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 1.5;
self.health = 2;
self.enemyType = 'spongebob';
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.lifetime = 0;
self.maxLifetime = 40;
self.color = 0xffff00;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
var alpha = 1 - self.lifetime / self.maxLifetime;
particleGraphics.alpha = alpha;
if (self.lifetime > self.maxLifetime) {
self.destroy();
}
};
return self;
});
var PlayerShip = Container.expand(function () {
var self = Container.call(this);
var shipGraphics = self.attachAsset('playerShip', {
anchorX: 0.5,
anchorY: 0.5
});
shipGraphics.rotation = -Math.PI / 2;
self.velocityX = 0;
self.velocityY = 0;
self.acceleration = 0.8;
self.friction = 0.92;
self.maxSpeed = 8;
self.rotation = 0;
self.health = 5;
self.canShoot = true;
self.shootCooldown = 0;
self.shieldActive = false;
self.shieldDuration = 0;
self.shieldMaxDuration = 120;
self.shieldGraphic = null;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityX *= self.friction;
self.velocityY *= self.friction;
var speed = Math.sqrt(self.velocityX * self.velocityX + self.velocityY * self.velocityY);
if (speed > self.maxSpeed) {
var ratio = self.maxSpeed / speed;
self.velocityX *= ratio;
self.velocityY *= ratio;
}
if (self.x < 40) self.x = 40;
if (self.x > 2008) self.x = 2008;
if (self.y < 40) self.y = 40;
if (self.y > 2692) self.y = 2692;
shipGraphics.rotation = self.rotation + Math.PI / 2;
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
if (self.shieldActive) {
self.shieldDuration++;
if (!self.shieldGraphic) {
self.shieldGraphic = self.addChild(new Shield());
}
if (self.shieldDuration >= self.shieldMaxDuration) {
self.shieldActive = false;
self.shieldDuration = 0;
if (self.shieldGraphic) {
self.shieldGraphic.destroy();
self.shieldGraphic = null;
}
}
}
};
return self;
});
var Shield = Container.expand(function () {
var self = Container.call(this);
var shieldRing = LK.getAsset('shieldCircle', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChild(shieldRing);
shieldRing.width = 280;
shieldRing.height = 280;
shieldRing.tint = 0xFFD700;
shieldRing.alpha = 0.6;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x001a4d
});
/****
* Game Code
****/
var playerShip = game.addChild(new PlayerShip());
playerShip.x = 1024;
playerShip.y = 1366;
var enemies = [];
var bullets = [];
var particles = [];
var coins = 0;
var health = 5;
var spawnRate = 60;
var spawnCounter = 0;
var shieldAbilityAvailable = true;
var lastShieldCoinThreshold = 0;
var lastAutomaticShieldCoins = 0;
var coinsTxt = new Text2('Coins: 0', {
size: 100,
fill: 0xFFD700
});
coinsTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(coinsTxt);
var healthHearts = [];
for (var h = 0; h < 5; h++) {
var heart = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
healthHearts.push(heart);
LK.gui.topLeft.addChild(heart);
}
for (var h = 0; h < healthHearts.length; h++) {
healthHearts[h].x = 60 + h * 50;
healthHearts[h].y = 50;
}
var keysPressed = {
w: false,
a: false,
s: false,
d: false
};
var mouseX = 1024;
var mouseY = 1366;
function createParticleExplosion(x, y) {
var bubbleCount = 5;
for (var i = 0; i < bubbleCount; i++) {
var particle = game.addChild(new Particle());
particle.x = x;
particle.y = y;
var angle = i / bubbleCount * Math.PI * 2;
var speed = 2.5 + Math.random() * 1.5;
particle.velocityX = Math.cos(angle) * speed;
particle.velocityY = Math.sin(angle) * speed;
var bubbleColors = [0x00ccff, 0x0099ff, 0x66ddff, 0x33bbff];
particle.color = bubbleColors[Math.floor(Math.random() * bubbleColors.length)];
particle.children[0].tint = particle.color;
particles.push(particle);
}
LK.getSound('explosion').play();
}
function spawnEnemy() {
var rand = Math.random();
var enemyType = rand < 0.5 ? 'basic' : 'tough';
var enemy = game.addChild(enemyType === 'basic' ? new EnemyBasic() : new EnemyTough());
var side = Math.floor(Math.random() * 4);
if (side === 0) {
enemy.x = Math.random() * 2048;
enemy.y = -30;
} else if (side === 1) {
enemy.x = 2048 + 30;
enemy.y = Math.random() * 2732;
} else if (side === 2) {
enemy.x = Math.random() * 2048;
enemy.y = 2732 + 30;
} else {
enemy.x = -30;
enemy.y = Math.random() * 2732;
}
var dx = playerShip.x - enemy.x;
var dy = playerShip.y - enemy.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
enemy.velocityX = dx / distance * enemy.speed;
enemy.velocityY = dy / distance * enemy.speed;
}
enemies.push(enemy);
}
game.move = function (x, y, obj) {
mouseX = x;
mouseY = y;
var dx = mouseX - playerShip.x;
var dy = mouseY - playerShip.y;
playerShip.rotation = Math.atan2(dy, dx);
};
game.down = function (x, y, obj) {
if (playerShip.shootCooldown <= 0) {
var bullet = game.addChild(new Bullet());
bullet.x = playerShip.x;
bullet.y = playerShip.y;
bullet.velocityX = Math.cos(playerShip.rotation) * bullet.speed;
bullet.velocityY = Math.sin(playerShip.rotation) * bullet.speed;
var bulletGraphics = bullet.children[0];
tween(bulletGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
easing: tween.easeOut
});
bullets.push(bullet);
playerShip.shootCooldown = 8;
LK.getSound('shoot').play();
}
};
var keyboardHandler = function keyboardHandler(e) {
if ((e.key === 'e' || e.key === 'E') && shieldAbilityAvailable && coins >= 100) {
playerShip.shieldActive = true;
playerShip.shieldDuration = 0;
coins -= 100;
coinsTxt.setText('Coins: ' + coins);
shieldAbilityAvailable = false;
lastShieldCoinThreshold = coins;
}
};
game.on('keydown', keyboardHandler);
game.update = function () {
spawnCounter++;
if (spawnCounter > spawnRate) {
spawnEnemy();
spawnCounter = 0;
if (spawnRate > 15) {
spawnRate = Math.max(15, 60 - Math.floor(coins / 5));
}
}
if (keysPressed.w) {
playerShip.velocityX += Math.cos(playerShip.rotation) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation) * playerShip.acceleration;
}
if (keysPressed.a) {
playerShip.velocityX += Math.cos(playerShip.rotation - Math.PI / 2) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation - Math.PI / 2) * playerShip.acceleration;
}
if (keysPressed.s) {
playerShip.velocityX += Math.cos(playerShip.rotation + Math.PI) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation + Math.PI) * playerShip.acceleration;
}
if (keysPressed.d) {
playerShip.velocityX += Math.cos(playerShip.rotation + Math.PI / 2) * playerShip.acceleration;
playerShip.velocityY += Math.sin(playerShip.rotation + Math.PI / 2) * playerShip.acceleration;
}
for (var b = bullets.length - 1; b >= 0; b--) {
var bullet = bullets[b];
if (bullet.lifetime === undefined) bullet.lifetime = 0;
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
for (var e = enemies.length - 1; e >= 0; e--) {
var enemy = enemies[e];
if (bullet.intersects(enemy)) {
enemy.health--;
if (enemy.health <= 0) {
createParticleExplosion(enemy.x, enemy.y);
coins += 10;
coinsTxt.setText('Coins: ' + coins);
enemy.destroy();
enemies.splice(e, 1);
} else {
var enemyGraphics = enemy.children[0];
enemyGraphics.tint = 0xcccccc;
}
bullet.destroy();
bullets.splice(b, 1);
break;
}
}
}
if (coins >= lastShieldCoinThreshold + 100) {
shieldAbilityAvailable = true;
}
if (coins >= lastAutomaticShieldCoins + 200) {
playerShip.shieldActive = true;
playerShip.shieldDuration = 0;
lastAutomaticShieldCoins = coins;
if (playerShip.shieldGraphic) {
playerShip.shieldGraphic.destroy();
playerShip.shieldGraphic = null;
}
playerShip.shieldGraphic = playerShip.addChild(new Shield());
}
for (var e = enemies.length - 1; e >= 0; e--) {
var enemy = enemies[e];
if (enemy.lastIntersecting === undefined) enemy.lastIntersecting = false;
var currentIntersecting = enemy.intersects(playerShip);
if (!enemy.lastIntersecting && currentIntersecting) {
if (playerShip.shieldActive) {
createParticleExplosion(enemy.x, enemy.y);
coins += 10;
coinsTxt.setText('Coins: ' + coins);
enemy.destroy();
enemies.splice(e, 1);
} else {
var damageAmount = enemy.enemyType === 'crab' ? 0.5 : 1;
health -= damageAmount;
playerShip.health = health;
for (var hIdx = 0; hIdx < healthHearts.length; hIdx++) {
if (hIdx < Math.floor(health)) {
healthHearts[hIdx].alpha = 1;
} else if (hIdx === Math.floor(health) && health % 1 !== 0) {
healthHearts[hIdx].alpha = 0.5;
} else {
healthHearts[hIdx].alpha = 0.3;
}
}
createParticleExplosion(enemy.x, enemy.y);
enemy.destroy();
enemies.splice(e, 1);
if (health <= 0) {
var leaderboardData = storage.leaderboard || [];
leaderboardData.push(coins);
leaderboardData.sort(function (a, b) {
return b - a;
});
if (leaderboardData.length > 10) {
leaderboardData = leaderboardData.slice(0, 10);
}
storage.leaderboard = leaderboardData;
LK.showGameOver();
}
LK.effects.flashObject(playerShip, 0xff0000, 300);
}
}
enemy.lastIntersecting = currentIntersecting;
if (enemy.x < -100 || enemy.x > 2148 || enemy.y < -100 || enemy.y > 2832) {
enemy.destroy();
enemies.splice(e, 1);
}
}
for (var p = particles.length - 1; p >= 0; p--) {
var particle = particles[p];
if (particle.lifetime > particle.maxLifetime) {
particle.destroy();
particles.splice(p, 1);
}
}
};
LK.playMusic('bgmusic', {
loop: true
});
"A funny 2D game character concept art. A glass fishbowl filled with water serving as the head. Inside the bowl, a small confused orange goldfish is swimming. The body is an extremely muscular mechanical robot body wearing a tight formal business suit. The character is holding a giant fish landing net as a weapon. Cartoon style, absurd, vibrant colors, clean vector lines.". In-Game asset. 2d. High contrast. No shadows
: Water bubble. In-Game asset. 2d. High contrast. No shadows
Red crab enemy. In-Game asset. 2d. High contrast. No shadows
red heart. In-Game asset. 2d. High contrast. No shadows
sungerbob benzerı ama aynısı degıl. In-Game asset. 2d. High contrast. No shadows
her renkten noktalar. In-Game asset. 2d. High contrast. No shadows
ICI BOS SARI DAIRE SADECE KENALARINDA SARI CIZGI OLACAK. In-Game asset. 2d. High contrast. No shadows