User prompt
broadcast game over once fanfare sound ends
User prompt
poison and hearts show still at 20
User prompt
Remove the score, doctor, and items when 20
User prompt
If you collect 20 score, Everything gets removed and an image called fanfare shows, While fanfare sound plays.
User prompt
Make the background image tummy
User prompt
Make the background Dark red
User prompt
Make it play Collectheart sound when collect heart
User prompt
Make sure the player is at the exact position of the cursor
User prompt
Please fix the bug: 'Uncaught ReferenceError: handleMove is not defined' in or related to this line: 'handleMove(x, y, obj);' Line Number: 95
User prompt
Recode the doctor cause its glitching
User prompt
When moving it looks like there is two players but theres not, Fix the illusion
User prompt
Please fix the bug: 'Uncaught ReferenceError: dragNode is not defined' in or related to this line: 'if (dragNode) {' Line Number: 98
User prompt
With mouse cursor
User prompt
Make it so you can drag the doctor instead
User prompt
The doctor keeps being choppy by disappearing and reappearing in a milisecond
User prompt
Make sure player is rendered at all times
Initial prompt
Heart Attack Doctors 1
/**** * Classes ****/ // Doctor class representing the player character var Doctor = Container.expand(function () { var self = Container.call(this); var doctorGraphics = self.attachAsset('doctor', { anchorX: 0.5, anchorY: 0.5 }); self.move = function (x, y, obj) { var game_position = game.toLocal(obj.global); self.x = game_position.x; self.y = game_position.y; }; }); //<Assets used in the game will automatically appear here> // Heart class representing the collectible heart var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 5; // Move downwards if (self.y > 2732) { self.destroy(); } }; }); // Poison class representing the harmful collectible var Poison = Container.expand(function () { var self = Container.call(this); var poisonGraphics = self.attachAsset('poison', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 5; // Move downwards if (self.y > 2732) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundImage: 'tummy' }); /**** * Game Code ****/ var doctor = new Doctor(); doctor.x = 2048 / 2; doctor.y = 2500; game.addChild(doctor); var hearts = []; var poisons = []; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function spawnHeart() { var heart = new Heart(); heart.x = Math.random() * 2048; heart.y = -50; hearts.push(heart); game.addChild(heart); } function spawnPoison() { var poison = new Poison(); poison.x = Math.random() * 2048; poison.y = -50; poisons.push(poison); game.addChild(poison); } var dragNode = null; // Declare the handleMove function function handleMove(x, y, obj) { //Get event position in relation to game object if (dragNode) { dragNode.x = x; dragNode.y = y; } } game.down = function (x, y, obj) { //Set drag node to doctor. dragNode = doctor; //Also call move handler right away to make effect instant. handleMove(x, y, obj); }; game.move = handleMove; game.update = function () { if (LK.ticks % 60 == 0) { spawnHeart(); spawnPoison(); } for (var i = hearts.length - 1; i >= 0; i--) { if (doctor.intersects(hearts[i])) { score += 1; scoreTxt.setText(score); hearts[i].destroy(); hearts.splice(i, 1); LK.getSound('CollectHeart').play(); if (score == 20) { var fanfare = game.attachAsset('fanfare', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); var fanfareSound = LK.getSound('fanfareSound'); fanfareSound.play(); doctor.destroy(); scoreTxt.destroy(); LK.setTimeout(function () { LK.showGameOver(); }, fanfareSound.duration * 1000); } } } for (var j = poisons.length - 1; j >= 0; j--) { if (doctor.intersects(poisons[j])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } }; //Mouse or touch up on game object game.up = function (x, y, obj) { dragNode = null; };
===================================================================
--- original.js
+++ change.js
@@ -115,11 +115,15 @@
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
- LK.getSound('fanfareSound').play();
+ var fanfareSound = LK.getSound('fanfareSound');
+ fanfareSound.play();
doctor.destroy();
scoreTxt.destroy();
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, fanfareSound.duration * 1000);
}
}
}
for (var j = poisons.length - 1; j >= 0; j--) {
A doctor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A heart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bottle of poison. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A person's inside of their stomach. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An image of doctors saving a person from an emergency situation. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.