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
@@ -26,46 +26,61 @@
return self;
});
var Booster = Container.expand(function (type) {
var self = Container.call(this);
- // Randomly assign a color
+ // Define boosters with adjusted colors and rarity levels
var colors = [{
- color: 0x80FF80,
+ color: 0x6FCF6F,
+ // Adjusted green
effect: 'increaseHealth',
- text: '+1 Health'
- },
- // Green
- {
- color: 0xFF8080,
+ text: '+1 Health',
+ rarity: 0.3 // Relatively common
+ }, {
+ color: 0xFF6F6F,
+ // Adjusted red
effect: 'increaseHarvestSpeed',
- text: '+10% Harvest Speed'
- },
- // Red
- {
- color: 0x8080FF,
+ text: '+10% Harvest Speed',
+ rarity: 0.4 // Most common
+ }, {
+ color: 0x6F6FFF,
+ // Adjusted blue
effect: 'increaseMaxCargo',
- text: '+5 Max Cargo'
- },
- // Blue
- {
- color: 0xFFFF80,
+ text: '+5 Max Cargo',
+ rarity: 0.15 // Neutral rarity
+ }, {
+ color: 0xFFF16F,
+ // Adjusted yellow
effect: 'increaseMovementSpeed',
- text: '+10% Movement Speed'
- },
- // Yellow
- {
- color: 0xBF80BF,
+ text: '+10% Movement Speed',
+ rarity: 0.15 // Neutral rarity
+ }, {
+ color: 0xB36FB3,
+ // Adjusted purple
effect: 'increaseProductionSpeed',
- text: '+10% Production Speed'
- },
- // Purple
- {
+ text: '+10% Production Speed',
+ rarity: 0.15 // Neutral rarity
+ }, {
color: 0xA0A0A0,
+ // Adjusted grey
effect: 'fillCargo',
- text: 'Cargo Filled!'
- } // Grey
- ];
- var selected = colors[Math.floor(Math.random() * colors.length)];
+ text: 'Cargo Filled!',
+ rarity: 0.05 // Extremely rare
+ }];
+ // Weighted random selection based on rarity
+ function selectBooster() {
+ var totalWeight = colors.reduce(function (sum, booster) {
+ return sum + booster.rarity;
+ }, 0);
+ var randomWeight = Math.random() * totalWeight;
+ var cumulativeWeight = 0;
+ for (var i = 0; i < colors.length; i++) {
+ cumulativeWeight += colors[i].rarity;
+ if (randomWeight <= cumulativeWeight) {
+ return colors[i];
+ }
+ }
+ }
+ var selected = selectBooster();
// Sparkle effect container
var sparkleContainer = new Container();
self.addChild(sparkleContainer); // Add sparkles first
// Attach booster graphics
@@ -73,28 +88,26 @@
anchorX: 0.5,
anchorY: 0.5,
tint: selected.color,
scaleX: 1.5,
- // Increased size
- scaleY: 1.5 // Increased size
+ scaleY: 1.5
});
// Start position (bottom-middle of the screen)
self.x = 2048 / 2;
self.y = 2432 - 200;
// Target position (random on the screen with boundaries)
- var margin = 150; // Boundary margin for safe landing
+ var margin = 150;
var targetX = margin + Math.random() * (2048 - 2 * margin);
var targetY = margin + Math.random() * (2432 - 300 - 2 * margin);
// Rotation and sparkle effects
var rotationSpeed = 0.01;
function emitSparkles() {
- var angle = Math.random() * Math.PI * 2; // Random angle around the booster
- var distance = boosterGraphics.width / 2 + 10; // Distance from the center
+ var angle = Math.random() * Math.PI * 2;
+ var distance = boosterGraphics.width / 2 + 10;
var sparkle = sparkleContainer.attachAsset('Stars', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: Math.random() * 2 + 0.3,
- // Larger spark sizes
scaleY: Math.random() * 2 + 0.3,
alpha: 0.2,
tint: 0xFFFFFF,
x: Math.cos(angle) * distance,
@@ -103,25 +116,25 @@
var lifetime = Math.random() * 400 + 200;
var elapsed = 0;
var interval = LK.setInterval(function () {
elapsed += 16;
- sparkle.y -= 0.5; // Subtle upward motion
- sparkle.alpha = Math.max(0, 1 - elapsed / lifetime); // Gradual fade-out
+ sparkle.y -= 0.5;
+ sparkle.alpha = Math.max(0, 1 - elapsed / lifetime);
if (elapsed >= lifetime) {
LK.clearInterval(interval);
sparkleContainer.removeChild(sparkle);
}
}, 16);
}
// Propulsion animation
var elapsedTime = 0;
- var duration = 1000; // 1 second to land
+ var duration = 1000;
LK.getSound('woosh').play();
self.update = function () {
elapsedTime += 16;
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
+ self.y = (1 - t) * (2432 - 200) + t * targetY - 100 * Math.sin(t * Math.PI);
if (t >= 1) {
LK.getSound('can').play();
self.update = function () {
boosterGraphics.rotation += rotationSpeed;
@@ -130,9 +143,8 @@
}
};
// Handle pickup and apply effect
self.pickUp = function () {
- // Play pickup sound
LK.getSound('Booster_Sound').play();
// Floating text with canvas
var canvas = self.attachAsset('Booster_Text_Canvas', {
anchorX: 0.5,
@@ -142,31 +154,27 @@
alpha: 1
});
var floatingText = new Text2(selected.text, {
size: 80,
- // Large size
fill: 0xFFFFFF,
- // White color
align: 'center'
});
floatingText.anchor.set(0.5, 0.5);
- // Set initial position (higher above booster)
- var textYOffset = 150; // Higher spawn point
+ var textYOffset = 150;
canvas.x = 2048 / 2;
canvas.y = 2732 / 2;
floatingText.x = canvas.x;
floatingText.y = canvas.y;
- game.addChild(canvas); // Add canvas first for layering
- game.addChild(floatingText); // Add text on top
- // Animate text and canvas together
+ game.addChild(canvas);
+ game.addChild(floatingText);
var elapsed = 0;
- var textDuration = 1000; // 1 second
+ var textDuration = 1000;
var fadeInterval = LK.setInterval(function () {
elapsed += 16;
- canvas.y -= 1.5; // Move upward slightly faster
+ canvas.y -= 1.5;
floatingText.y -= 1.5;
- canvas.alpha = Math.max(0, 1 - elapsed / textDuration); // Fade out
- floatingText.alpha = Math.max(0, 1 - elapsed / textDuration); // Fade out
+ canvas.alpha = Math.max(0, 1 - elapsed / textDuration);
+ floatingText.alpha = Math.max(0, 1 - elapsed / textDuration);
if (elapsed >= textDuration) {
LK.clearInterval(fadeInterval);
game.removeChild(canvas);
game.removeChild(floatingText);
@@ -179,18 +187,18 @@
globalHealthBar.setHealth(globalHealthBar.currentHealth + 1);
}
break;
case 'increaseHarvestSpeed':
- mishnu.harvestSpeed = mishnu.harvestSpeed * 1.1; // Increase by 10%
+ mishnu.harvestSpeed *= 1.1;
break;
case 'increaseMaxCargo':
- mishnu.cargoMax = Math.round(mishnu.cargoMax + 5); // Increase by 5 and round to nearest whole number
+ mishnu.cargoMax = Math.round(mishnu.cargoMax + 5);
break;
case 'increaseMovementSpeed':
- mishnu.speed = mishnu.speed * 1.1; // Increase by 10%
+ mishnu.speed *= 1.1;
break;
case 'increaseProductionSpeed':
- factory.processInterval = Math.max(1000, factory.processInterval * 0.9); // Increase speed by 10%
+ factory.processInterval = Math.max(1000, factory.processInterval * 0.9);
break;
case 'fillCargo':
mishnu.humansHarvested = mishnu.cargoMax;
break;
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