User prompt
Slow down mishnu's movement. Make her radius smaller. And make sure she can harvest humans (atm she's not harvesting humans for some reason) and make sure she can harvest more than one human at once
User prompt
The harvesting process is not working correctly. Keep it simple. Any human that enters her radius and stays in it for 2 seconds gets harvested no matter what. If there are more than one our script handles each human independently as they enter the radius at different times and their 2 second timer for harvesting started at different times.
User prompt
The visual representation of the radius does not match the script's size of the radius. Also it seems our asset mishnu, loads underneath the radius making her invisible
User prompt
Slow down mishnu's movement by half
User prompt
still way to fast. she needs to be following the cursor, but it's too fast. she should be dragging behind the cursor most of the time.
User prompt
mishnu is still way too fast, fix this
Code edit (9 edits merged)
Please save this source code
User prompt
When cargo appears over 100% text appears red. If cargo is under 100% it remains white.
User prompt
Please fix the bug: 'TypeError: cargoText.style is undefined' in or related to this line: 'cargoText.style.fill = 0xFFFFFF; // White color' Line Number: 170
Code edit (3 edits merged)
Please save this source code
User prompt
Mishnu emits sound Dog_Panting continuously in loop
User prompt
THere is music in background: It plays Music_Level_1_5 alternating with Music_Level_1_4 in a loop. We will refer to this as the music loop
User prompt
Please fix the bug: 'TypeError: LK.getCurrentMusic is not a function' in or related to this line: 'if (LK.getCurrentMusic() == 'Music_Level_1_5') {' Line Number: 172
User prompt
Please fix the bug: 'TypeError: LK.getMusic is not a function' in or related to this line: 'if (LK.getMusic() == 'Music_Level_1_5') {' Line Number: 172
User prompt
Its play sound not getcurrentmusic. you loafing lk sounds so call the proper function
User prompt
Make sure the sounds are alternating
User prompt
Its no lk current music its lk sound. just play them on after the other, and do this in a loop
User prompt
Please fix the bug: 'TypeError: LK.playSound is not a function' in or related to this line: 'LK.playSound('Music_Level_1_5');' Line Number: 175
Code edit (2 edits merged)
Please save this source code
User prompt
Whenever a human is being harvested he will emit sound Agony_Yell_1. However the sound starts at a random point of it's 10 second duration
User prompt
No, When the human enters the radius the sound plays, when he exits the radius or is harvested the sound stops.
User prompt
No the sound needs to start playing at a random point in the sound. It shouldn't start from the start of our 10 second sound. It needs to start at random part of the sound
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: fadeOutSound is not defined' in or related to this line: 'fadeOutSound(LK.getSound('Agony_Yell_1'), 1000); // Fade out over 1 second' Line Number: 87
Code edit (6 edits merged)
Please save this source code
/****
* Classes
****/
// Class for Mishnu's harvest radius
var HarvestRadius = Container.expand(function () {
var self = Container.call(this);
var radiusGraphics = self.attachAsset('radius', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 4 // Decrease the scale of the radius
});
self.update = function () {
self.x = mishnu.x;
self.y = mishnu.y;
};
return self;
});
// Class for Humans, the targets
var Human = Container.expand(function () {
var self = Container.call(this);
Container.call(self);
var humanGraphics = self.attachAsset('human', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = (Math.random() * 2 - 1) * 2; // Slower random speed in X direction
self.speedY = (Math.random() * 2 - 1) * 2; // Slower random speed in Y direction
self.inRadiusStartTime = null; // Track time in radius
self.isBeingHarvested = false;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
// Bounce off edges of the viewport
if (self.x < 50 || self.x > 2048 - 50) {
self.speedX *= -1;
self.x = self.x < 50 ? 50 : 2048 - 50; // Keep humans within the viewport
}
if (self.y < 50 || self.y > 2732 - 200) {
self.speedY *= -1;
self.y = self.y < 50 ? 50 : 2732 - 200; // Keep humans above the text area
} // Avoid bottom reserved area
// Check if this human is in Mishnu's radius
var dx = self.x - mishnu.x;
var dy = self.y - mishnu.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 150) {
// Mishnu's radius
var runSpeed = 2; // Further reduce speed to make escape less frequent
self.x += dx / distance * runSpeed;
self.y += dy / distance * runSpeed;
if (!self.isBeingHarvested) {
self.isBeingHarvested = true;
self.inRadiusStartTime = Date.now();
} else if (Date.now() - self.inRadiusStartTime >= 2000) {
// Harvest the human
game.removeChild(self); // Remove human from the game
humans.splice(humans.indexOf(self), 1); // Remove from array
mishnu.humansHarvested++;
self.isBeingHarvested = false; // Reset harvesting after human is harvested
self.inRadiusStartTime = null;
}
} else {
self.isBeingHarvested = false; // Reset harvesting if out of radius
self.inRadiusStartTime = null;
}
};
return self;
});
// Class for Mishnu, the main character
var Mishnu = Container.expand(function () {
var self = Container.call(this);
Container.call(self);
var mishnuGraphics = self.attachAsset('mishnu', {
anchorX: 0.5,
anchorY: 0.5,
zIndex: 1 // Ensure Mishnu is above the radius
});
self.speed = 2; // Decrease Mishnu's speed
self.humansHarvested = 0;
self.lastHarvestTime = 0;
self.targetX = 2048 / 2;
self.targetY = 2732 - 200;
self.update = function () {
// Move Mishnu towards the cursor with smooth turns
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
var smoothFactor = 0.1; // Smoothing factor for turns
if (distance > 0) {
self.x += dx * smoothFactor;
self.y += dy * smoothFactor;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize Mishnu
var mishnu = game.addChild(new Mishnu());
mishnu.x = 2048 / 2;
mishnu.y = 2732 - 200;
// Initialize Mishnu's harvest radius
var radius = game.addChild(new HarvestRadius());
radius.x = mishnu.x;
radius.y = mishnu.y;
// Array to hold humans
var humans = [];
// Create humans at random positions
for (var i = 0; i < 50; i++) {
// Increased number of humans to spawn more
var human = new Human();
human.x = Math.random() * 2048;
human.y = Math.random() * 2732 - 100; // Avoid bottom reserved area
humans.push(human);
game.addChild(human);
}
// Handle mouse movement to set Mishnu's target position
game.move = function (x, y, obj) {
if (y < 2732 - 100) {
// Avoid bottom reserved area
mishnu.targetX = x;
mishnu.targetY = y;
}
};
// Add a new text field to display the number of humans harvested by Mishnu
var cargoText = new Text2('Cargo: 0 / 10', {
size: 50,
fill: 0xFFFFFF
});
cargoText.anchor.set(1, 1); // Anchor to the bottom right corner
LK.gui.bottomRight.addChild(cargoText);
// Update game logic
game.update = function () {
humans.forEach(function (human) {
human.update();
});
mishnu.update();
radius.update(); // Update the harvest radius
// Update the cargo text field
cargoText.setText('Cargo: ' + mishnu.humansHarvested + ' / 10');
};
blurry texture background 4k black and white
can of Dog Food. Game asset. 3d clipart. Blank background. High contrast. No shadows..
black capsule. Game asset. 3d clipart. Blank background. High contrast. No shadows..
woman in short shorts. mobile game art. pixel art. full body. front facing. Blank background. High contrast. No shadows.
laser beam cartoon game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bone. clipart. cartoon. Blank background. High contrast. No shadows..
Game Over. Red game letters, dripping. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Dog_panting
Sound effect
Agony_Yell_1
Sound effect
Music_Level_1_5
Music
Music_Level_1_4
Music
Agony_Yell_2
Sound effect
Agony_Yell_3
Sound effect
Agony_Yell_4
Sound effect
Agony_Yell_5
Sound effect
Agony_Yell_6
Sound effect
Agony_Yell_7
Sound effect
Dog_Crunch
Sound effect
Dog_Crunch_2
Sound effect
Dog_Crunch_3
Sound effect
Ding_1
Sound effect
Squish_1
Sound effect
Squish_2
Sound effect
Squish_4
Sound effect
Squish_3
Sound effect
Factory_Deposit
Sound effect
Factory_Operation
Sound effect
Level_Up
Sound effect
Bark
Sound effect
Hit
Sound effect
Agony_Yell_8
Sound effect
Agony_Yell_9
Sound effect
GiggleMan_1
Sound effect
GiggleMan_2
Sound effect
GiggleMan_3
Sound effect
GiggleMan_4
Sound effect
Booster_Sound
Sound effect
Can
Sound effect
woosh
Sound effect
Agony_Yell_10
Sound effect
Bark_2
Sound effect
Bark_3
Sound effect
laser
Sound effect
searing
Sound effect
laser_2
Sound effect
Laser_3
Sound effect
Laser_4
Sound effect
Boss_Hit
Sound effect
Boss_Hit_2
Sound effect
Boss_Hit_3
Sound effect
GiggleMan_5
Sound effect
GiggleMan_6
Sound effect
hip_hop_loop
Sound effect