User prompt
Check if sMetalMusic is playing every 4.25 seconds
User prompt
Check if sMetalMusic is playing every 4 seconds
User prompt
Check if sMetalMusic is playing every 5 seconds
User prompt
and if it isn't playing, play smetalmusic
User prompt
Please fix the bug: 'Timeout.tick error: LK.getSound(...).isPlaying is not a function' in or related to this line: 'if (!LK.getSound('sMetalMusic').isPlaying()) {' Line Number: 197
User prompt
Check if sMetalMusic is playing every 3 seconds
User prompt
now play it 1.5 seconds after the game starts and loop it
User prompt
LK.setTimeout(function () { var metalMusic = LK.getSound('sMetalMusic'); metalMusic.loop = true; metalMusic.play(); }, 1000);
User prompt
do it
User prompt
death is inevitable should be in white
User prompt
when bluenemy, redenemy and yellowenemy are outside of the playspace destroy them
User prompt
after specialobject is instanciated play sound sWallSound
User prompt
before instanciating bloodsplatter play sound sSplurt or sSplurt2 or Splurt3
User prompt
0.5 seconds after game start play sHohoho sound
User prompt
when game start play sHohoho sound
User prompt
before game over play sound sHohoho
User prompt
before greenpowerup is destroyed play sExplosion sound
User prompt
when greenpowerup is destroyed play sExplosion
User prompt
when santa fires, play sBazooka sound
User prompt
Migrate to the latest version of LK
Code edit (1 edits merged)
Please save this source code
User prompt
spawnobject should spawn when the game begins
Code edit (1 edits merged)
Please save this source code
User prompt
the wall seems to lose momentum as it moves down after being pushed back, fix it so it reverts to its initial downward speed
User prompt
when special object receives a bullet, it shouldn't be able to receive anymore bullets momentarily
var SpecialObject = Container.expand(function () {
var self = Container.call(this);
var specialObjectGraphics = self.createAsset('specialObject', 'Special Object', .5, .5);
specialObjectGraphics.scale.x *= 4;
self.speed = 2;
self.move = function () {
self.y += self.speed;
};
self.canBeHit = true;
self.hit = function () {
if (!self.canBeHit) return;
self.canBeHit = false;
self.speed = Math.abs(self.speed) * -0.5;
LK.setTimeout(function () {
self.speed = Math.abs(self.speed);
self.canBeHit = true;
}, 1000);
};
});
var GraySquare = Container.expand(function () {
var self = Container.call(this);
var graySquareGraphics = self.createAsset('graySquare', 'Gray Square', .5, .5);
graySquareGraphics.width = 150;
graySquareGraphics.height = 150;
graySquareGraphics.tint = 0x808080;
});
var GreenPowerup = Container.expand(function () {
var self = Container.call(this);
var powerupGraphics = self.createAsset('greenPowerup', 'Green Powerup', .5, .5);
self.amplitude = 10;
self.frequency = 0.05;
self.baseY = self.y;
self.move = function () {
self.y = self.baseY + self.amplitude * Math.sin(LK.ticks * self.frequency);
};
});
var BloodSplatter = Container.expand(function () {
var self = Container.call(this);
var scale = (0.5 + Math.random() * 0.5) * 2.5;
var splatterGraphics = self.createAsset('bloodSplatter', 'Blood splatter effect', .5, .5);
splatterGraphics.scale.set(scale, scale);
self.lifeSpan = 500;
self.on('tick', function () {
self.lifeSpan -= 16.6667;
if (self.lifeSpan <= 0) {
LK.setTimeout(function () {
self.destroy();
}, 3000);
}
});
});
var Santa = Container.expand(function () {
var self = Container.call(this);
var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5);
santaGraphics.rotation = -Math.PI / 2;
self.direction = 1;
self.speed = 15;
self.move = function () {
if (self.x >= 2048 - this.width * 0.6 || self.x <= this.width * 0.6) {
self.direction *= -1;
santaGraphics.scale.y *= -1;
}
self.x += self.speed * self.direction;
};
self.fire = function () {
this.direction *= -1;
santaGraphics.scale.y *= -1;
};
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var scale = 0.5 + Math.random() * 0.5;
var bulletGraphics = self.createAsset('bullet', 'Bullet Graphics', .5, .5);
bulletGraphics.scale.set(scale, scale);
self.speed = 20;
self.move = function () {
self.y -= self.speed;
};
});
var YellowEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('yellowEnemy', 'Yellow Enemy character', .5, .5);
self.speed = 3.75;
self.scaleIncrement = 0.2;
self.scaleTimer = 0;
self.move = function () {
self.y += self.speed;
if (self.y > LK.stageContainer.height) {
self.destroy();
}
self.scaleTimer += 1 / 60;
if (self.scaleTimer >= 1) {
self.scale.x += self.scaleIncrement;
self.scale.y += self.scaleIncrement;
self.scaleTimer = 0;
}
};
});
var BlueEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('blueEnemy', 'Blue Enemy character', .5, .5);
self.speed = 6.25;
self.teleportTimer = 0;
self.teleportInterval = 1;
self.move = function () {
self.y += self.speed;
if (self.y > LK.stageContainer.height) {
self.destroy();
}
self.teleportTimer += 1 / 60;
if (self.teleportTimer >= self.teleportInterval) {
var teleportDirection = Math.random() < 0.5 ? -200 : 200;
self.x += Math.max(0, Math.min(2048 - self.width, self.x + teleportDirection)) - self.x;
self.teleportTimer = 0;
}
};
});
var RedEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('redEnemy', 'Red Enemy character', .5, .5);
self.speed = 10;
self.move = function () {
self.y += self.speed;
if (self.y > LK.stageContainer.height) {
self.destroy();
}
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var background = self.createAsset('background', 'Game background', 0, 0);
background.width = 2048;
background.height = 2732;
self.addChildAt(background, 0);
var santa = self.addChild(new Santa());
var greenPowerup;
var greenPowerupSpawnTimer;
var score = 0;
var specialObject;
var specialObjectSpawned = false;
var scoreTxt = new Text2(score.toString(), {
size: 100,
fill: "#FFA500"
});
scoreTxt.y += 94;
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var remainingBulletsTxt = new Text2('Bullets: 5', {
size: 70,
fill: "#FFA500"
});
remainingBulletsTxt.y = scoreTxt.height + 114;
remainingBulletsTxt.anchor.set(0.5, 0);
LK.gui.topCenter.addChild(remainingBulletsTxt);
var bullets = [];
var enemies = [];
santa.x = 2048 / 2;
santa.y = 2732 - santa.height;
var spawnEnemy = function () {
var enemyType = Math.random();
var enemy;
if (enemyType < 0.33) {
enemy = new YellowEnemy();
} else if (enemyType < 0.66) {
enemy = new BlueEnemy();
} else {
enemy = new RedEnemy();
}
var boundaryPadding = enemy.width;
enemy.x = Math.random() * (2048 - boundaryPadding * 2) + boundaryPadding;
enemy.y = 0;
enemies.push(enemy);
if (specialObject && specialObject.parent === self) {
self.addChildAt(enemy, self.getChildIndex(specialObject));
} else {
if (specialObject && specialObject.parent === self) {
self.addChildAt(enemy, self.getChildIndex(specialObject) - 1);
} else {
self.addChild(enemy);
}
}
};
var fireBullet = function () {
if (bullets.length < 5) {
santa.fire();
var bullet = new Bullet();
bullet.x = santa.x;
bullet.y = santa.y - santa.height / 2 - bullet.height / 2;
var graySquare = new GraySquare();
graySquare.x = bullet.x;
graySquare.y = bullet.y + 50;
self.addChild(graySquare);
LK.setTimeout(function () {
graySquare.destroy();
}, 500);
bullets.push(bullet);
self.addChild(bullet);
bullet.move();
remainingBulletsTxt.setText('Bullets: ' + (5 - bullets.length).toString());
}
};
stage.on('down', function (obj) {
if (santa.x > santa.width * 0.6 && santa.x < 2048 - santa.width * 0.6) {
fireBullet();
}
});
LK.on('tick', function () {
santa.move();
bullets.forEach(function (bullet, bulletIndex) {
bullet.move();
if (bullet.y < -bullet.height) {
bullet.destroy();
bullets.splice(bulletIndex, 1);
remainingBulletsTxt.setText('Bullets: ' + (5 - bullets.length).toString());
return;
}
enemies.forEach(function (enemy, enemyIndex) {
if (bullet.intersects(enemy)) {
bullet.destroy();
var splatter = new BloodSplatter();
splatter.x = enemy.x;
splatter.y = enemy.y;
self.addChild(splatter);
enemy.destroy();
enemies.forEach(function (e) {
e.speed *= 1.1;
});
score += 1;
if (score >= 2 && !specialObjectSpawned) {
specialObject = new SpecialObject();
specialObject.x = 2048 / 2;
specialObject.y = -1300;
self.addChild(specialObject);
specialObjectSpawned = true;
var deathText = new Text2('Death Is Inevitable', {
size: 150,
fill: '#000000',
align: 'center'
});
deathText.anchor.set(0.5, 0.5);
deathText.x = 2048 / 4 + 225;
deathText.y = 2732 / 2 - deathText.height / 2 - 300;
LK.gui.topLeft.addChild(deathText);
var toggleTransparency = function () {
deathText.alpha = deathText.alpha === 1 ? 0 : 1;
};
var transparencyInterval = LK.setInterval(toggleTransparency, 500);
LK.setTimeout(function () {
LK.clearInterval(transparencyInterval);
deathText.destroy();
}, 5000);
}
scoreTxt.setText(score.toString());
santa.speed += 1;
bullets.splice(bulletIndex, 1);
enemies.splice(enemyIndex, 1);
remainingBulletsTxt.setText('Bullets: ' + (4 - bullets.length).toString());
} else if (greenPowerup && bullet.intersects(greenPowerup)) {
bullets.splice(bulletIndex, 1);
bullet.destroy();
enemies.forEach(function (e) {
var splatter = new BloodSplatter();
splatter.x = e.x;
splatter.y = e.y;
self.addChild(splatter);
e.destroy();
score += 1;
});
enemies.length = 0;
greenPowerup.destroy();
LK.effects.flashScreen(0x808080, 1000);
santa.speed = 15;
greenPowerup = undefined;
scoreTxt.setText(score.toString());
remainingBulletsTxt.setText('Bullets: ' + (4 - bullets.length).toString());
}
});
});
if (specialObject) {
specialObject.move();
bullets.forEach(function (bullet, bulletIndex) {
if (bullet.intersects(specialObject) && specialObject.canBeHit) {
specialObject.hit();
bullet.destroy();
bullets.splice(bulletIndex, 1);
remainingBulletsTxt.setText('Bullets: ' + (5 - bullets.length).toString());
}
});
}
enemies.forEach(function (enemy) {
enemy.move();
if (santa.intersects(enemy)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
isGameOver = true;
}
});
});
var enemySpawnRate = 1000 / 1.75;
var enemySpawnTimer = LK.setInterval(spawnEnemy, enemySpawnRate);
LK.on('tick', function () {});
greenPowerupSpawnTimer = LK.setInterval(function () {
if (greenPowerup && !greenPowerup.isDestroyed) {
return;
}
greenPowerup = new GreenPowerup();
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var randomOffsetX = (Math.random() - 0.5) * 1200;
var randomOffsetY = (Math.random() - 0.5) * 1200;
greenPowerup.x = centerX + randomOffsetX - greenPowerup.width / 2;
greenPowerup.y = centerY + randomOffsetY - greenPowerup.height / 2;
greenPowerup.move = function () {
this.angle += 0.05;
this.x = this.center.x + this.radius * Math.cos(this.angle);
this.y = this.center.y + this.radius * Math.sin(this.angle);
};
self.addChild(greenPowerup);
}, 15000);
});
a top view of a 16 bit sprite santa with a bazooka Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit sprite of a christmas ornament Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit sprite of a red eyed christmas elf Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit sprite of a blood splatter Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit sprite of a red eye reindeer Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit sprite of a red eye mother christmas Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit top view background of a christmas field set in hell Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit smoke Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit wall of skulls with red eyes Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"Death Is Inevitable" Text Bubble Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
16 bit CHRISTMAS bomb power up icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.