User prompt
Not sure why, but when adding mishnu harvesting rate funstionality to human and zombie, they can no longer be harvested. please fix
Code edit (2 edits merged)
Please save this source code
User prompt
For our text animation when booster is picked up, make it so that the canvas and the text appear in the center of the view port.
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: canvas is undefined' in or related to this line: 'canvas.x = self.x;' Line Number: 188
Code edit (1 edits merged)
Please save this source code
User prompt
Boosters need to appear bigger. The whole thing looks too small, adjust the size make it bigger
User prompt
My boosters are still not spawning in when mishnu snax (dog food) increase by 1, can you fix this?
User prompt
Ensure game.update processes the boosters
User prompt
Please fix the bug: 'uiLayer is undefined' in or related to this line: 'var factory = uiLayer.addChild(new Factory());' Line Number: 728
User prompt
Ensure the factory instance is initialized before referencing it in the code. same with ui layer, lets simply move the booster class after these are defined
User prompt
Please fix the bug: 'factory is undefined' in or related to this line: 'var originalIncreaseDogFood = factory.startProcessing;' Line Number: 724
Code edit (1 edits merged)
Please save this source code
User prompt
Instead of saying dog food: in our game in the ui, it will say Mishnu Snax: We can keep dog food internally but the display will say Mishnu Snax: for the player
User prompt
for some reason the innerhealthbar is not receiving the grey tint flash on zombie hit. can you solve this
User prompt
Please fix the bug: 'Timeout.tick error: target is undefined' in or related to this line: 'return target.tint = 0xFFFFFF;' Line Number: 779
User prompt
Validate targets in flashGreyMask Function: Modify the function to ensure only valid objects with a tint property are processed. I need the grey mask to flash when mishnu gets hit over mishnu, the harvest radius, and the innerHealthbar. I tried to create a helper function for this as you can see. I suggested above maybe a way to fix this, maybe you have a better way.
User prompt
Please fix the bug: 'Timeout.tick error: target is undefined' in or related to this line: 'return target.tint = tintColor;' Line Number: 786
Code edit (2 edits merged)
Please save this source code
User prompt
a delay of.2 seconds on the bark sound
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: self is undefined' in or related to this line: 'self.removeChild(hitSpark);' Line Number: 684
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'hitSpark.x = self.x + Math.cos(angle) * radius;' Line Number: 672
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'var hitSpark = self.attachAsset('HitSpark', {' Line Number: 660
Code edit (5 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -24,19 +24,56 @@
}
};
return self;
});
-// Booster Class
var Booster = Container.expand(function (type) {
var self = Container.call(this);
// Randomly assign a color
- var colors = [0x00FF00, 0xFF0000, 0x0000FF, 0xFFFF00, 0x800080, 0x808080]; // Green, Red, Blue, Yellow, Purple, Grey
- var color = colors[Math.floor(Math.random() * colors.length)];
+ var colors = [{
+ color: 0x80FF80,
+ effect: 'increaseHealth',
+ text: '+1 Health'
+ },
+ // Green
+ {
+ color: 0xFF8080,
+ effect: 'increaseHarvestSpeed',
+ text: '+10% Harvest Speed'
+ },
+ // Red
+ {
+ color: 0x8080FF,
+ effect: 'increaseMaxCargo',
+ text: '+5 Max Cargo'
+ },
+ // Blue
+ {
+ color: 0xFFFF80,
+ effect: 'increaseMovementSpeed',
+ text: '+10% Movement Speed'
+ },
+ // Yellow
+ {
+ color: 0xBF80BF,
+ effect: 'increaseProductionSpeed',
+ text: '+10% Production Speed'
+ },
+ // Purple
+ {
+ color: 0xA0A0A0,
+ effect: 'fillCargo',
+ text: 'Cargo Filled!'
+ } // Grey
+ ];
+ var selected = colors[Math.floor(Math.random() * colors.length)];
+ // Sparkle effect container
+ var sparkleContainer = new Container();
+ self.addChild(sparkleContainer); // Add sparkles first
// Attach booster graphics
var boosterGraphics = self.attachAsset('Booster', {
anchorX: 0.5,
anchorY: 0.5,
- tint: color,
+ tint: selected.color,
scaleX: 1.5,
// Increased size
scaleY: 1.5 // Increased size
});
@@ -48,21 +85,19 @@
var targetY = Math.random() * (2432 - 300);
// Rotation and sparkle effects
var rotationSpeed = 0.01;
function emitSparkles() {
- // Position sparks around the edges of the booster
var angle = Math.random() * Math.PI * 2; // Random angle around the booster
var distance = boosterGraphics.width / 2 + 10; // Distance from the center
- var sparkle = self.attachAsset('Stars', {
+ var sparkle = sparkleContainer.attachAsset('Stars', {
anchorX: 0.5,
anchorY: 0.5,
- scaleX: Math.random() * 0.5 + 0.3,
+ scaleX: Math.random() * 2 + 0.3,
// Larger spark sizes
- scaleY: Math.random() * 0.5 + 0.3,
- alpha: 1,
+ scaleY: Math.random() * 2 + 0.3,
+ alpha: 0.2,
tint: 0xFFFFFF,
x: Math.cos(angle) * distance,
- // Spread out around the booster
y: Math.sin(angle) * distance
});
var lifetime = Math.random() * 400 + 200;
var elapsed = 0;
@@ -71,9 +106,9 @@
sparkle.y -= 0.5; // Subtle upward motion
sparkle.alpha = Math.max(0, 1 - elapsed / lifetime); // Gradual fade-out
if (elapsed >= lifetime) {
LK.clearInterval(interval);
- self.removeChild(sparkle);
+ sparkleContainer.removeChild(sparkle);
}
}, 16);
}
// Propulsion animation
@@ -85,20 +120,81 @@
var t = Math.min(1, elapsedTime / duration);
self.x = (1 - t) * (2048 / 2) + t * targetX;
self.y = (1 - t) * (2432 - 200) + t * targetY - 100 * Math.sin(t * Math.PI); // Arc-like motion
if (t >= 1) {
- // Play landing sound and transition to idle
LK.getSound('can').play();
self.update = function () {
boosterGraphics.rotation += rotationSpeed;
emitSparkles();
};
}
};
- // Handle pickup
+ // Show floating text with canvas
+ function showFloatingText(effectText) {
+ // Create the canvas
+ var canvas = new Container(); // Initialize canvas as a new Container
+ canvas.x = self.x;
+ canvas.y = self.y - 50; // Spawn slightly above the booster
+ game.addChild(canvas);
+ // Create the text
+ var floatingText = new Text2(effectText, {
+ size: 80,
+ // Large size
+ fill: 0xFFFFFF,
+ // White color
+ align: 'center'
+ });
+ floatingText.anchor.set(0.5, 0.5);
+ floatingText.x = canvas.x;
+ floatingText.y = canvas.y;
+ game.addChild(floatingText);
+ // Animate both canvas and text together
+ var elapsed = 0;
+ var duration = 1000; // 1 second
+ var fadeInterval = LK.setInterval(function () {
+ elapsed += 16;
+ canvas.y -= 1; // Move upward
+ floatingText.y -= 1; // Move upward
+ canvas.alpha = Math.max(0, 1 - elapsed / duration); // Fade out
+ floatingText.alpha = Math.max(0, 1 - elapsed / duration); // Fade out
+ if (elapsed >= duration) {
+ LK.clearInterval(fadeInterval);
+ game.removeChild(canvas);
+ game.removeChild(floatingText);
+ }
+ }, 16);
+ }
+ // Handle pickup and apply effect
self.pickUp = function () {
// Play pickup sound
LK.getSound('Booster_Sound').play();
+ // Show floating text
+ showFloatingText(selected.text);
+ // Apply effect based on booster type
+ switch (selected.effect) {
+ case 'increaseHealth':
+ if (globalHealthBar.currentHealth < globalHealthBar.maxHealth) {
+ globalHealthBar.setHealth(globalHealthBar.currentHealth + 1);
+ }
+ break;
+ case 'increaseHarvestSpeed':
+ mishnu.harvestSpeed = mishnu.harvestSpeed * 1.1; // Increase by 10%
+ break;
+ case 'increaseMaxCargo':
+ mishnu.cargoMax = Math.round(mishnu.cargoMax + 5); // Increase by 5 and round to nearest whole number
+ break;
+ case 'increaseMovementSpeed':
+ mishnu.speed = mishnu.speed * 1.1; // Increase by 10%
+ break;
+ case 'increaseProductionSpeed':
+ factory.processInterval = Math.max(1000, factory.processInterval * 0.9); // Increase speed by 10%
+ break;
+ case 'fillCargo':
+ mishnu.humansHarvested = mishnu.cargoMax;
+ break;
+ default:
+ console.error('Unknown booster effect:', selected.effect);
+ }
// Quick removal effect
var fadeOutInterval = LK.setInterval(function () {
boosterGraphics.alpha -= 0.1;
if (boosterGraphics.alpha <= 0) {
@@ -479,9 +575,9 @@
var zombieGraphics = self.attachAsset('Zombie', {
anchorX: 0.5,
anchorY: 0.5
});
- zombieGraphics.tint = 0xe29118; // Blue tint for the mask
+ zombieGraphics.tint = 0x007e94; // Blue tint for the mask
// Attributes
self.speed = 2;
self.harvestTime = 4000; // Time (ms) in radius to get harvested
self.attackCooldown = 3000; // Cooldown (ms) between attacks
@@ -660,9 +756,9 @@
****/
// Modify game logic to include zombie spawning
// Declare healthBar globally for accessibility
var game = new LK.Game({
- backgroundColor: 0x000000
+ backgroundColor: 0x1d1d1d
});
/****
* Game Code
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