User prompt
Can objtoasts end X destination always vary as long as it remains within the boundaries of the playspace? Do it
User prompt
make it feel more like a pulsating effect
User prompt
objradio scaling is too smooth, make it feel more clunky
User prompt
objradio scales too much, shorten it
User prompt
remove the static objradio graphic
User prompt
obj radios scaling animation should be different of divetoeat
User prompt
do not reset the visibilit yof divetoeat, when its at 0, leave it at 0 until the game is restarted
User prompt
do not reset its visibility
User prompt
set visibility of divetoeat to 0 when seagull dives
User prompt
make it more fluid, its too similar
User prompt
give the same Scaling Animation of objradio to divetoeat
User prompt
animate divetoeat properly
User prompt
divetoeat is not animted, fix it
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'update')' in or related to this line: 'divetoeat.update = function () {' Line Number: 794
User prompt
animate divetoeat, make it scale up and down slowly like its pulsating,
User prompt
divetoeat is not stretching itself, do that i want it to stand out
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'update')' in or related to this line: 'divetoeat.update = function () {' Line Number: 797
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'update')' in or related to this line: 'divetoeat.update = function () {' Line Number: 797
User prompt
animate divetoeat, stretch and scale it by 1.2x
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'seagull.addChild(divetoeat);' Line Number: 999
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'divetoeat = seagull.addChild(LK.getAsset('DivetoEat', {' Line Number: 996
/**** * Classes ****/ var Background02 = Container.expand(function () { var self = Container.call(this); var background02Graphics = self.attachAsset('objBackground02', { anchorX: 0.5, anchorY: 0.5 }); // Add wind animation in the update method self.update = function () { // Simulate wind blowing by rotating the object slightly self.rotation = Math.sin(LK.ticks / 120) * 0.05; // Rotate more back and forth with increased effect }; }); var Background04 = Container.expand(function () { var self = Container.call(this); var background04Graphics = self.attachAsset('objBackground04', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += Math.sin(LK.ticks / 60) * 0.2; // Reduced floating effect }; }); var Background06 = Container.expand(function () { var self = Container.call(this); var background06Graphics = self.attachAsset('objBackground06', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += Math.sin(LK.ticks / 60) * 0.2; // Reduced floating effect self.rotation = Math.sin(LK.ticks / 60) * 0.05 + Math.sin(LK.ticks / 120) * 0.03; // Add a more complex rotation pattern }; }); var Background07 = Container.expand(function () { var self = Container.call(this); var background07Graphics = self.attachAsset('objBackground07', { anchorX: 0.5, anchorY: 0.5 }); // Add wind animation in the update method self.update = function () { // Simulate wind blowing by rotating the object slightly self.rotation = Math.sin(LK.ticks / 120) * 0.08; // Rotate a bit less back and forth }; }); var Background13 = Container.expand(function () { var self = Container.call(this); var background13Graphics = self.attachAsset('objBackground13', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.direction = Math.random() > 0.5 ? 1 : -1; // Randomly choose a direction self.update = function () { var background13Graphics = self.children[0]; // Access the attached asset self.x += self.speed * self.direction; // Flip the image depending on the direction background13Graphics.scale.x = self.direction * (0.75 + Math.random() * 0.25); // Check if background13 is out of bounds horizontally if (self.x > 2048 + background13Graphics.width / 2 || self.x < -background13Graphics.width / 2) { self.destroy(); // Destroy background13 when it goes out of bounds game.background13Active = false; // Reset the flag when objBackground13 is destroyed } }; }); var ObjCartF = Container.expand(function () { var self = Container.call(this); var cartFGraphics = self.attachAsset('ObjCartF', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // No specific update logic for ObjCartF }; }); var ObjCrab = Container.expand(function () { var self = Container.call(this); var crabGraphics = self.attachAsset('objCrab', { anchorX: 0.5, anchorY: 0.5 }); self.y = 2400; self.speed = 2.2 + Math.random() * (3.5 - 2.2); self.update = function () { self.x += self.speed; self.y += Math.sin(LK.ticks / 3) * 2; // Add vertical waddling effect self.rotation = Math.sin(LK.ticks / 20) * 0.1; // Add rotation for waddling effect if (self.attached) { self.x = objContactPoint.x; self.y = objContactPoint.y; if (!self.scoreUpdated) { self.scoreUpdated = true; // Ensure score is only updated once per snatch self.snatchStartTick = LK.ticks; // Record the tick when snatch starts flashScreenDuringSnatch(); // Start flashing the screen with various colors waveEffect(); // Start wave effect } if (LK.ticks % 60 == 0 && self.attached) { score += 5; // Increase score by 5 every second when snatch is true } } // Check for intersection with objContactPoint if (self.intersects(objContactPoint)) { self.attached = true; // Set attached state to true when snatched game.down = null; // Disable left click when a crab is snatched if (hungerMeter.width < 2048) { hungerMeter.width += 3; // Refill the hunger bar faster hungerMeter.tint = 0x00ff00; // Change color to green when increasing if (!game.objYum) { game.objYum = game.addChild(LK.getAsset('objYum', { anchorX: 0.5, anchorY: 0.5 })); game.objYum.x = game.objImHungry.x; game.objYum.y = game.objImHungry.y; } game.objYum.visible = 1; objStar.visible = 1; pulsateScore(); // Call pulsate effect } } // Check for intersection with objBackground08 only if not snatched if (!self.attached && self.intersects(background8)) { var sandDust = game.addChild(new ObjSandDust()); sandDust.x = self.x + 200; sandDust.y = self.y; self.destroy(); } // Check if objCrab is out of bounds if (self.y > 2732 + self.height / 2 || self.y < -self.height / 2 || self.x > 2048 + self.width / 2 || self.x < -self.width / 2) { self.destroy(); if (crab && crab.attached) { crab.attached = false; // Re-enable left click LK.setTimeout(function () { game.down = function (x, y, obj) { if (!seagull.diving && !seagull.returning && (!crab || !crab.attached)) { seagull.diving = true; seagull.diveTime = 0; seagull.startX = seagull.x; seagull.startY = seagull.y; seagull.endX = seagull.startX + seagull.speed * seagull.direction * seagull.diveDuration / 2; } if (!gustSpawned && !gustCooldown) { var objGust = game.addChildAt(new ObjGust(), game.getChildIndex(seagull)); objGust.x = seagull.x; objGust.y = seagull.y; LK.setTimeout(function () { objGust.destroy(); }, 100); gustSpawned = true; gustCooldown = true; LK.setTimeout(function () { gustCooldown = false; }, 2000); } // Play a random sound (snoise, snoise02, snoise03) var sounds = ['SNoise', 'SNoise02', 'SNoise03']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); // Play a random sound (snoise, snoise02, snoise03) var sounds = ['SNoise', 'SNoise02', 'SNoise03']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); }; }, 500); // Re-enable left click after 0.5 second } else { // Failsafe: Ensure left click is re-enabled if crab is not attached game.down = function (x, y, obj) { if (!seagull.diving && !seagull.returning && (!crab || !crab.attached)) { // Only start diving if not already diving or returning seagull.diving = true; seagull.diveTime = 0; seagull.startX = seagull.x; seagull.startY = seagull.y; // Calculate endX based on current speed and direction seagull.endX = seagull.startX + seagull.speed * seagull.direction * seagull.diveDuration / 2; } if (!gustSpawned && !gustCooldown) { // Spawn objGust behind seagull var objGust = game.addChildAt(new ObjGust(), game.getChildIndex(seagull)); objGust.x = seagull.x; // Position at the center of the seagull objGust.y = seagull.y; LK.setTimeout(function () { objGust.destroy(); }, 100); // Destroy objGust after 0.1 seconds gustSpawned = true; // Set gustSpawned flag to true gustCooldown = true; // Set gustCooldown flag to true LK.setTimeout(function () { gustCooldown = false; // Reset gustCooldown flag after 2 seconds }, 2000); } }; } } }; }); var ObjFish = Container.expand(function () { var self = Container.call(this); var fishGraphics = self.attachAsset('objFish', { anchorX: 0.5, anchorY: 0.5 }); var startX = 1000; // Centered X position var startY = 1875; // Centered Y position self.x = startX; self.y = startY; var scaleDirection = 1; self.update = function () { // Make the fish swim around its starting position var newX = startX + Math.sin(LK.ticks / 60) * 50; if (newX < self.x) { fishGraphics.scale.x = -1; // Flip horizontally } else { fishGraphics.scale.x = 1; // Default orientation } self.x = newX; self.y = startY + Math.cos(LK.ticks / 60) * 30; // Slowly scale the fish up and down if (self.scale.x >= 1.1) { scaleDirection = -1; } else if (self.scale.x <= 0.9) { scaleDirection = 1; } self.scale.x += scaleDirection * 0.001; self.scale.y += scaleDirection * 0.001; }; }); var ObjGust = Container.expand(function () { var self = Container.call(this); var gustGraphics = self.attachAsset('objGust', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y -= 6; // Move vertically up self.alpha -= 0.02; // Gradually disappear over 0.5 seconds (30 frames) if (self.alpha <= 0) { intersecting = false; // Reset intersecting flag self.destroy(); // Destroy the object when fully transparent } }; }); var ObjMusica = Container.expand(function () { var self = Container.call(this); var musicaGraphics = self.attachAsset('objMusica', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += Math.sin(LK.ticks / 15) * 0.15; // Further reduced ripple vertical movement self.x += Math.cos(LK.ticks / 35) * 0.15; // Further reduced ripple horizontal movement }; }); var ObjNPC01 = Container.expand(function () { var self = Container.call(this); var npcGraphics = self.attachAsset('objNPC01', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.x += self.speed * self.direction; if (self.x < -npcGraphics.width / 2 || self.x > 2048 + npcGraphics.width / 2) { self.destroy(); if (activeGrawlix) { activeGrawlix.destroy(); activeGrawlix = null; } game.npcActive = false; } // Check for intersection with objContactPoint if (self.intersects(objContactPoint) && !self.accelerated) { self.speed *= 2; // Double the speed self.accelerated = true; // Ensure this happens only once // Check if objGrawlix is already active before spawning a new one if (!activeGrawlix) { // Spawn objGrawlix over objNPC01 activeGrawlix = game.addChild(LK.getAsset('ObjGrawlix', { anchorX: 0.5, anchorY: 0.5 })); } activeGrawlix.x = self.x; activeGrawlix.y = self.y; activeGrawlix.startTick = LK.ticks; // Initialize startTick for grawlix activeGrawlix.update = function () { this.x = self.x; this.y = self.y - 200; if (!this.objPotatoes && LK.ticks - this.startTick >= 60) { // 1 second delay at 60 FPS this.objPotatoes = game.addChild(LK.getAsset('ObjPotatoes', { anchorX: 0.5, anchorY: 0.5 })); this.objPotatoes.startTick = LK.ticks; // Initialize startTick for objPotatoes this.objPotatoes.x = this.x; this.objPotatoes.y = this.y; this.objPotatoes.update = function () { if (LK.ticks - this.startTick < 120) { // 2 seconds at 60 FPS this.y += 5; // Animate falling down a few pixels in Y } else if (this.intersects(seagull)) { // Destroy ObjPotatoes this.destroy(); // Play either SEat or Crunch sound var sounds = ['SEat', 'Crunch']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); // Instantiate ObjCartoonP at ObjPotatoes's position var ObjCartoonP = game.addChild(LK.getAsset('ObjCartoonP', { anchorX: 0.5, anchorY: 0.5 })); ObjCartoonP.x = this.x; ObjCartoonP.y = this.y; // Destroy ObjCartoonP after 2 seconds LK.setTimeout(function () { ObjCartoonP.destroy(); }, 2000); // Refill hunger bar by 20% hungerMeter.width = Math.min(hungerMeter.width + 409.6, 2048); // Add +20 to the score score += 20; // Flash screen yellow for 0.5 seconds LK.effects.flashScreen(0xffff00, 500); // Update score display scoreText.setText('Score: ' + score); } }; } }; } }; }); var ObjPDroplet = Container.expand(function () { var self = Container.call(this); var dropletGraphics = self.attachAsset('objPDroplet', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 10 + Math.random() * 5; // Increased freefall speed with added y randomness self.x += seagull.speed * seagull.direction * 0.1; // Follow the direction of the seagull on the X axis if (self.y > 2600 + Math.random() * 200) { // Check if it reaches anywhere near the bottom of the screen var splash = game.addChild(new ObjPSplash()); splash.x = self.x; splash.y = self.y; self.destroy(); LK.setTimeout(function () { splash.destroy(); }, 2000); // Destroy splash after 2 seconds } }; }); var ObjPSplash = Container.expand(function () { var self = Container.call(this); var splashGraphics = self.attachAsset('objPSplash', { anchorX: 0.5, anchorY: 0.5 }); }); var ObjSandDust = Container.expand(function () { var self = Container.call(this); var sandDustGraphics = self.attachAsset('objSandDust', { anchorX: 0.5, anchorY: 0.5 }); self.alpha = 1.0; self.update = function () { self.y -= 1; // Move upwards self.alpha -= 0.01; // Gradually disappear over 2 seconds (60 frames per second) if (self.alpha <= 0) { self.destroy(); // Destroy the object when fully transparent } }; }); var Seagull = Container.expand(function () { var self = Container.call(this); var seagullGraphics = self.attachAsset('objSeagull', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5 * Math.pow(1.2, Math.floor(score / 65)) * (1 + Math.floor(score / 65) * 0.1); self.direction = 1; self.diving = false; self.diveTime = 0; self.diveDuration = 60; // Total duration of the dive in frames self.startX = 0; self.startY = 0; self.endX = 0; self.endY = 2732 - seagullGraphics.height / 2 - 200; // Target Y position for the dive self.returning = false; self.update = function () { if (self.diving) { self.diveTime++; var t = self.diveTime / self.diveDuration; // Normalized time (0 to 1) self.x = (1 - t) * self.startX + t * self.endX; // Linear horizontal movement self.y = (1 - t) * self.startY + t * self.endY; // Keep vertical movement unchanged divetoeat.visible = 0; // Set visibility of divetoeat to 0 when seagull dives if (self.diveTime >= self.diveDuration) { self.diveTime = 0; self.diving = false; self.returning = true; // Start returning to original position gustSpawned = false; // Reset gustSpawned flag self.startX = self.x; // Update startX to the current X self.startY = self.y; // Update startY to the current Y (bottom of the dive) self.endY = 475; // Return to the original Y position self.endX = self.startX + self.speed * self.direction * self.diveDuration / 2; // Move further ahead } } else if (self.returning) { self.diveTime++; var t = self.diveTime / self.diveDuration; // Normalized time (0 to 1) self.x = (1 - t) * self.startX + t * self.endX; // Linear horizontal movement back self.y = (1 - t) * self.startY + t * self.endY; // Keep vertical movement unchanged if (self.diveTime >= self.diveDuration) { self.diveTime = 0; self.returning = false; // End the return phase self.diving = false; // Reset diving state self.startX = self.x; // Reset startX for the next dive self.startY = self.y; // Reset startY for the next dive self.endY = 2732 - seagullGraphics.height / 2 - 200; // Reset endY for the next dive } } else { intersecting = false; self.x += self.speed * self.direction; self.y += Math.sin(LK.ticks / 10) * 5; // Add a hover effect // Check if seagull is out of bounds horizontally if (self.x > 2048 + seagullGraphics.width / 2 || self.x < -seagullGraphics.width / 2) { self.direction *= -1; // Flip direction self.x = Math.max(-seagullGraphics.width / 2, Math.min(2048 + seagullGraphics.width / 2, self.x)); // Keep seagull within bounds self.y = score > 375 ? Math.random() * (2732 * 0.5) + 100 : Math.random() * (2732 * 0.3) + 100; // Random Y position in the upper 50% of the playspace with a 100px boundary if score > 375, else 30% // Flip the seagull's graphics seagullGraphics.scale.x *= -1; } } // Update the score display scoreText.setText('Score: ' + score); // Decrease hungerMeter's width over time if seagull is not snatching fries or crab if (hungerMeter.width > 0 && (!crab || !crab.attached)) { if (!game.crashSoundInterval) { LK.getSound('SoundCrash').play(); game.crashSoundInterval = LK.setInterval(function () { LK.getSound('SoundCrash').play(); }, 10000); } if (crab && crab.attached && hungerMeter.width < 2048) { hungerMeter.tint = 0xffffff; // Reset color when not decreasing hungerMeter.width += 2; // Refill the hunger bar progressively } if (hungerMeter.width < 2048 * 0.35 && LK.ticks % 120 == 0) { // Trigger shake intermittently every 2 seconds screenShake(500, 15); // Shake for 500ms with increased intensity of 15 pixels } hungerMeter.width -= 1.5; // Decrease the rate of decrease hungerMeter.tint = 0xff0000; // Change color to red when decreasing scoreText.tint = 0xffffff; // Change score text color back to white LK.clearInterval(pulsateInterval); // Stop pulsating effect // Instantiate objImHungry for two seconds over objHead if (!game.objImHungry) { game.objImHungry = game.addChild(LK.getAsset('objImHungry', { anchorX: 0.5, anchorY: 0.5 })); game.objImHungry.x = head.x + 150; game.objImHungry.y = head.y - 25; } if (game.objYum) { game.objYum.visible = 0; } objStar.visible = 0; if (LK.ticks % 60 == 0) { updateScore(score + 1 * scoreMultiplier); self.speed = 10 * Math.pow(1.1, Math.floor(score / 65)) * (1 + Math.floor(score / 65) * 0.1); if (score >= lastScoreThreshold + 85) { lastScoreThreshold += 85; var objWaveCrash = game.addChild(LK.getAsset('objWaveCrash', { anchorX: 0.5, anchorY: 0.5 })); objWaveCrash.x = 1025; objWaveCrash.y = 1850; LK.setTimeout(function () { objWaveCrash.destroy(); if (!game.objSingleFish) { game.objSingleFish = game.addChild(LK.getAsset('objSingleFish', { anchorX: 0.5, anchorY: 0.5 })); game.objSingleFish.x = 1175; game.objSingleFish.y = 1850; var startX = game.objSingleFish.x; var startY = game.objSingleFish.y; var endY = 2150; var duration = 60; // Duration of the animation in frames (1 second) var currentFrame = 0; game.objSingleFish.update = function () { if (currentFrame <= duration) { var t = currentFrame / duration; game.objSingleFish.y = (1 - t) * startY + t * endY; game.objSingleFish.scale.set(2.5); // Ensure it remains at 250% of its original scale currentFrame++; } else { // Animate looking around by flipping horizontally if (LK.ticks % 120 < 60) { game.objSingleFish.scale.set(2.5, game.objSingleFish.scale.y); // Ensure it remains at 250% of its original scale while facing right } else { game.objSingleFish.scale.set(-2.5, game.objSingleFish.scale.y); // Ensure it remains at 250% of its original scale while facing left } } }; game.objSingleFish.initialized = true; } }, 1000); // Delay of 1 second before replacing with objSingleFish } } // Stop shake and pulsate effects LK.clearInterval(shakeInterval); if (pulsateIntervalActive) { LK.clearInterval(pulsateInterval); pulsateIntervalActive = false; // Reset flag when pulsateInterval is cleared } } // Check if fries or crab leave the playspace if (typeof crab !== 'undefined' && (crab.y > 2732 + crab.height / 2 || crab.y < -crab.height / 2 || crab.x > 2048 + crab.width / 2 || crab.x < -crab.width / 2)) { crab.destroy(); } // Initialize objBackground13 every 6 to 15 seconds if (!game.background13Active && LK.ticks % (60 * (Math.floor(Math.random() * 10) + 6)) == 0) { var background13 = game.addChildAt(new Background13(), game.getChildIndex(seagull) - 1); background13.direction = Math.random() > 0.5 ? 1 : -1; // Randomly choose a direction background13.x = background13.direction > 0 ? -background13.width / 2 : 2048 + background13.width / 2; // Start from the left or right edge of the playspace background13.y = Math.random() * (2732 * 0.2) + 50; // Random Y position in the upper 20% of the playspace with a 50px boundary game.background13Active = true; // Set the flag to indicate that objBackground13 is active background13.update = function () { var background13Graphics = this.children[0]; // Access the attached asset this.x += this.speed * this.direction; // Flip the image depending on the direction background13Graphics.scale.x = this.direction; // Check if background13 is out of bounds horizontally if (this.x > 2048 + background13Graphics.width / 2 || this.x < -background13Graphics.width / 2) { this.destroy(); // Destroy background13 when it goes out of bounds game.background13Active = false; // Reset the flag when objBackground13 is destroyed } }; } // Spawn ObjNPC01 every 15 to 25 seconds if not already active if (!game.npcActive && LK.ticks % (60 * (Math.floor(Math.random() * 11) + 15)) == 0) { var npc = game.addChildAt(new ObjNPC01(), game.getChildIndex(background3) + 1); if (Math.random() > 0.5) { npc.x = -npc.width / 2; // Start from outside the left edge of the playspace npc.direction = 1; // Move towards the right npc.children[0].scale.x *= -1; // Flip the visual horizontally } else { npc.x = 2048 + npc.width / 2; // Start from outside the right edge of the playspace npc.direction = -1; // Move towards the left } npc.y = 1950; npc.accelerated = false; // Initialize accelerated flag game.npcActive = true; } // Spawn objCrab every 10 seconds if (LK.ticks % (60 * 10) == 0) { crab = new ObjCrab(); crab.attached = false; // Initialize attached state crab.x = -crab.width / 2; // Start from the utmost left game.addChildAt(crab, game.getChildIndex(background9)); // Add crab behind objBackground09 } // Initialize ObjToast every 10 seconds if it does not exist if (LK.ticks % (60 * 10) == 0 && !game.ObjToast) { var ObjToast = game.addChild(LK.getAsset('ObjToast', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, scaleY: 0.5 })); ObjToast.x = 75; ObjToast.y = 1150; game.ObjToast = ObjToast; // Animate ObjToast var startX = 75; var startY = 1150; // Start from the bottom of the screen var endX = Math.random() * (2048 - ObjToast.width) + ObjToast.width / 2; var endY = 2090; var duration = 60; // Duration of the animation in frames (1 second) var currentFrame = 0; ObjToast.x = startX; ObjToast.y = startY; ObjToast.update = function () { if (currentFrame <= duration) { var t = currentFrame / duration; ObjToast.x = (1 - t) * startX + t * endX; ObjToast.y = (1 - t) * startY + t * endY - 300 * t * (1 - t); // Parabolic movement ObjToast.scale.set(0.5 + 0.5 * t); // Gradually scale by 50% currentFrame++; } // Check for intersection with objSeagull if (ObjToast.intersects(seagull)) { // Destroy ObjToast ObjToast.destroy(); game.ObjToast = null; // Play either SEat or Crunch sound var sounds = ['SEat', 'Crunch']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); // Instantiate ObjMunch at ObjToast's position var ObjMunch = game.addChild(LK.getAsset('ObjMunch', { anchorX: 0.5, anchorY: 0.5 })); ObjMunch.x = ObjToast.x; ObjMunch.y = ObjToast.y; // Destroy ObjMunch after 1 second LK.setTimeout(function () { ObjMunch.destroy(); }, 1000); // Refill hunger bar by 10% hungerMeter.width = Math.min(hungerMeter.width + 204.8, 2048); // Add +10 to the score score += 10; // Flash screen yellow for 0.5 seconds LK.effects.flashScreen(0xffff00, 500); // Update score display scoreText.setText('Score: ' + score); } }; } // Trigger game over when hungerMeter's width reaches 0 if (hungerMeter.width <= 0) { if (game.crashSoundInterval) { LK.clearInterval(game.crashSoundInterval); game.crashSoundInterval = null; } var redOverlay = game.addChild(LK.getAsset('objRedOverlay', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1 })); redOverlay.x = 1024; redOverlay.y = 1366; LK.setTimeout(function () { var objDizzy = game.addChild(LK.getAsset('objDizzy', { anchorX: 0.5, anchorY: 0.5 })); objDizzy.x = 1024; objDizzy.y = 1366; LK.setScore(score); scoreText.visible = false; // Set visibility of score to 0 during game over LK.setTimeout(function () { LK.showGameOver(); //Calling this will destroy the 'Game' and reset entire game state. }, 3000); // Delay game over by 3 seconds }, 100); // Delay game over by 0.1 seconds } // Attach objContactPoint to the center of seagull objContactPoint.x = self.x; objContactPoint.y = self.y + 200; // Check for intersection with objSingleFish if (objContactPoint.intersects(game.objSingleFish)) { // Destroy objSingleFish game.objSingleFish.destroy(); game.objSingleFish = null; // Play either SEat or Crunch sound var sounds = ['SEat', 'Crunch']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); // Instantiate ObjCartF at objSingleFish's position var objCartF = game.addChildAt(new ObjCartF(), game.children.length - 1); objCartF.x = objContactPoint.x; objCartF.y = objContactPoint.y; // Destroy ObjCartF after 2 seconds LK.setTimeout(function () { objCartF.destroy(); }, 2000); // Refill the hunger bar by 15% hungerMeter.width = Math.min(hungerMeter.width + 307.2, 2048); // Flash screen yellow for 0.5 seconds LK.effects.flashScreen(0xffff00, 500); // Add 15 to the score score += 15; scoreText.setText('Score: ' + score); } // Check for intersection with objCrab if (objContactPoint.intersects(crab) && !crab.seatSoundPlayed) { crab.seatSoundPlayed = true; // Ensure sound is only played once // Play either SEat or Crunch sound var sounds = ['SEat', 'Crunch']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); } }; // Remove the down event from the seagull as we want to trigger it from anywhere in the playspace }); var SeagullShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('objSeagullShadow', { anchorX: 0.5, anchorY: 0.5, alpha: 0.5 }); self.update = function () { self.x = seagull.x + 20; // Offset shadow slightly self.y = 2575 - 100; // Keep shadow at the bottom of the screen // Calculate scale based on seagull's Y position var maxScale = 3; var minScale = 1; var maxY = 2732 - seagull.height / 2 - 200; var minY = 475; var t = (seagull.y - minY) / (maxY - minY); var scale = minScale + t * (maxScale - minScale); self.scale.set(scale, scale); }; }); var Smoke = Container.expand(function () { var self = Container.call(this); var smokeGraphics = self.attachAsset('objSmoke', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += Math.sin(LK.ticks / 60) * 0.2; // Reduced floating effect }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ function updateScore(newScore) { score = newScore; scoreText.setText('Score: ' + score); if (score >= lastScoreThreshold + 80) { lastScoreThreshold += 80; var objWaveCrash = game.addChild(LK.getAsset('objWaveCrash', { anchorX: 0.5, anchorY: 0.5 })); objWaveCrash.x = 1025; objWaveCrash.y = 1850; LK.setTimeout(function () { objWaveCrash.destroy(); if (!game.objSingleFish) { game.objSingleFish = game.addChild(LK.getAsset('objSingleFish', { anchorX: 0.5, anchorY: 0.5 })); } if (!game.objSingleFish.initialized) { game.objSingleFish.x = 1025; game.objSingleFish.y = 1850; var startX = game.objSingleFish.x; var startY = game.objSingleFish.y; var endY = 2100; var duration = 60; // Duration of the animation in frames (1 second) var currentFrame = 0; game.objSingleFish.update = function () { if (currentFrame <= duration) { var t = currentFrame / duration; game.objSingleFish.x = (1 - t) * startX + t * endX; game.objSingleFish.y = (1 - t) * startY + t * endY; game.objSingleFish.y = (1 - t) * startY + t * endY; game.objSingleFish.scale.set(2.5); // Ensure it remains at 250% of its original scale currentFrame++; } else { // Animate looking around by flipping horizontally if (LK.ticks % 120 < 60) { game.objSingleFish.scale.set(2.5, game.objSingleFish.scale.y); // Ensure it remains at 250% of its original scale while facing right } else { game.objSingleFish.scale.set(-2.5, game.objSingleFish.scale.y); // Ensure it remains at 250% of its original scale while facing left } } }; game.objSingleFish.initialized = true; } if (!game.objSingleFish.initialized) { game.objSingleFish.x = 1025; game.objSingleFish.y = 1850; var startX = game.objSingleFish.x; var startY = game.objSingleFish.y; var endX = 1475; var endY = 2000; var duration = 60; // Duration of the animation in frames (1 second) var currentFrame = 0; game.objSingleFish.update = function () { if (currentFrame <= duration) { var t = currentFrame / duration; game.objSingleFish.y = (1 - t) * startY + t * endY; game.objSingleFish.scale.set(1 + 1.5 * t); // Scale up by 250% currentFrame++; } else { // Animate looking around by flipping horizontally if (LK.ticks % 60 < 30) { game.objSingleFish.scale.x = 1; // Face right } else { game.objSingleFish.scale.x = -1; // Face left } } }; game.objSingleFish.initialized = true; } }, 1000); // Delay of 1 second before replacing with objSingleFish } } game.npcActive = false; var scoreMultiplier = 1; // Initialize scoreMultiplier variable var lastScoreThreshold = 0; // Variable to track the last score threshold crossed function waveEffect() { if (crab && crab.attached) { game.y += Math.sin(LK.ticks / 30) * 1; // Apply further reduced wave effect game.x += Math.cos(LK.ticks / 30) * 0.5; // Further lower the horizontal wave effect if (objMultipliertext.visible === 0) { objMultipliertext.visible = 1; // Set visibility to 1 when waveEffect is active LK.getSound('Party').play(); // Play Party sound when objMultipliertext becomes visible } objMultipliertext.rotation += 0.05; // Rotate objMultipliertext scoreMultiplier = 2; // Enable score multiplier LK.setTimeout(waveEffect, 16); // Continue wave effect every frame (60 FPS) } else { game.y = 0; // Reset playspace position to original game.x = 0; // Reset playspace position to original if (objMultipliertext.visible === 1) { objMultipliertext.visible = 0; // Set visibility to 0 when waveEffect is not active LK.getSound('Party').stop(); // Stop Party sound when objMultipliertext becomes invisible } objMultipliertext.rotation += 0.05; // Rotate objMultipliertext scoreMultiplier = 1; // Disable score multiplier } } function flashScreenDuringSnatch() { var colors = [0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff]; var colorIndex = 0; function flash() { if (crab && crab.attached) { LK.effects.flashScreen(colors[colorIndex], 500); colorIndex = (colorIndex + 1) % colors.length; LK.setTimeout(flash, 500); } } function waveEffect() { if (crab && crab.attached) { game.y += Math.sin(LK.ticks / 30) * 1; // Apply further reduced wave effect game.x += Math.cos(LK.ticks / 30) * 0.5; // Further lower the horizontal wave effect LK.setTimeout(waveEffect, 16); // Continue wave effect every frame (60 FPS) } else { game.y = 0; // Reset playspace position to original game.x = 0; // Reset playspace position to original } } flash(); waveEffect(); } function pulsateScore() { var originalTint = scoreText.tint; var pulsateDuration = 1000; // Duration of one pulsate cycle in milliseconds function pulsate() { scoreText.tint = 0x00ff00; // Change to green LK.setTimeout(function () { scoreText.tint = originalTint; // Change back to original color }, pulsateDuration / 2); } pulsateInterval = LK.setInterval(pulsate, pulsateDuration); pulsateIntervalActive = true; // Set flag to true when pulsateInterval is active // Stop pulsating after a certain condition (e.g., hunger bar is full) // LK.clearInterval(pulsateInterval); } LK.setInterval(function () { var droplet = game.addChild(new ObjPDroplet()); droplet.x = seagull.x; droplet.y = seagull.y; droplet.direction = seagull.direction; // Set the direction of the droplet to match the seagull }, (Math.random() * 10 + 10) * 1000); // Random interval between 10 to 20 seconds var scaleDirectionRadio = 1; var scaleDirectionDive = 1; LK.setInterval(function () { // Unique scaling for objRadio var scaleFactorRadio = 1 + scaleDirectionRadio * 0.005; objRadio.scale.x *= scaleFactorRadio; objRadio.scale.y *= scaleFactorRadio; if (objRadio.scale.x >= 1.15 || objRadio.scale.x <= 0.85) { scaleDirectionRadio *= -1; } // Unique scaling for divetoeat var scaleFactorDive = 1 + scaleDirectionDive * 0.01; divetoeat.scale.x *= scaleFactorDive; divetoeat.scale.y *= scaleFactorDive; if (divetoeat.scale.x >= 1.2 || divetoeat.scale.x <= 0.8) { scaleDirectionDive *= -1; } }, 16); // Update every frame for smoother animation function screenShake(duration, intensity) { var originalX = game.x; var originalY = game.y; var shakeInterval = LK.setInterval(function () { game.x = originalX + (Math.random() - 0.5) * intensity; game.y = originalY + (Math.random() - 0.5) * intensity; }, 16); // Shake every frame (60 FPS) LK.setTimeout(function () { LK.clearInterval(shakeInterval); game.x = originalX; game.y = originalY; }, duration); } var crab; // Declare crab in the global scope var activeGrawlix = null; // Declare a global variable to track the active objGrawlix var snatchStartTick = 0; // Initialize snatchStartTick variable var objContactPoint; // Declare objContactPoint in the global scope var gustSpawned = false; // Flag to track if objGust has been spawned var gustCooldown = false; // Flag to track if the cooldown period is active var background = game.addChild(LK.getAsset('ObjBackground01', { anchorX: 0.5, anchorY: 0.5 })); background.x = 1024; background.y = 1366; var objSmoke = game.addChild(new Smoke()); objSmoke.x = 975; objSmoke.y = 875; var objFish = game.addChild(new ObjFish()); objFish.x = 1024; objFish.y = 1366; // Position objFish at y 1366 objFish.visible = true; // Ensure objFish is visible var background11 = game.addChild(LK.getAsset('objBackground11', { anchorX: 0.5, anchorY: 0.5 })); background11.x = 25; background11.y = 1300; var background10 = game.addChild(LK.getAsset('objBackground10', { anchorX: 0.5, anchorY: 0.5 })); var divetoeat = LK.gui.top.addChild(LK.getAsset('DivetoEat', { anchorX: 0.5, anchorY: 0.5 })); divetoeat.x = 0; // Center horizontally divetoeat.y = 900; // Center vertically // Removed duplicate objRadio instantiation var objMusica = game.addChild(new ObjMusica()); objMusica.x = 400; objMusica.y = 1100; background10.x = 125; background10.y = 2500; var background9 = game.addChild(LK.getAsset('objBackground09', { anchorX: 0.5, anchorY: 0.5 })); background9.x = 450; background9.y = 2490; var background8 = game.addChild(LK.getAsset('objBackground08', { anchorX: 0.5, anchorY: 0.5 })); background8.x = 1475; background8.y = 2455; var background7 = game.addChild(new Background07()); background7.x = 150; background7.y = 2650; var background6 = game.addChild(new Background06()); background6.x = 1175; background6.y = 1035; var background4 = game.addChild(new Background04()); var objSos = game.addChild(LK.getAsset('ObjSos', { anchorX: 0.5, anchorY: 0.5 })); objSos.rotation = -0.436332; // Rotate by -25 degrees (in radians) objSos.x = 1110; objSos.y = 850; objSos.update = function () { objSos.y += Math.sin(LK.ticks / 30) * 0.5; // Further reduced vertical wave effect objSos.x += Math.cos(LK.ticks / 60) * 0.25; // Further reduced horizontal wave effect }; var background5 = game.addChild(LK.getAsset('objBackground05', { anchorX: 0.5, anchorY: 0.5 })); var objRadio = game.addChild(LK.getAsset('objRadio', { anchorX: 0.5, anchorY: 0.5 })); objRadio.x = 265; objRadio.y = 1165; var background12 = game.addChild(LK.getAsset('objBackground12', { anchorX: 0.5, anchorY: 0.5 })); background12.x = 850; background12.y = 3335; background5.x = 165; background5.y = 1925; background4.x = 1024; background4.y = 990; var background2 = game.addChild(new Background02()); background2.x = 1790; background2.y = 1766; var background3 = game.addChildAt(LK.getAsset('objBackground03', { anchorX: 0.5, anchorY: 0.5 }), game.getChildIndex(background2) - 1); background3.x = 1824; background3.y = 2166; var seagull = game.addChild(new Seagull()); var seagullShadow = game.addChild(new SeagullShadow()); intersecting = false; // Reset intersecting flag crabSmokeInstantiated = false; // Reset crab smoke flag gustSpawned = false; // Reset gust spawned flag gustCooldown = false; // Reset gust cooldown flag seagull.x = -seagull.width / 2; // Start from outside the left edge of the playspace seagull.y = 475; if (typeof crab !== 'undefined') { crab.attached = false; // Reset attached state for crab crab.destroy(); // Ensure the crab is destroyed and reset } var hungerMeter = game.addChild(LK.getAsset('objHungerMeter', { anchorX: 0.5, anchorY: 0.5, width: 2048 })); hungerMeter.x = 1024; hungerMeter.y = 2650; var objMultipliertext = game.addChildAt(LK.getAsset('objMultipliertext', {}), game.getChildIndex(background2) + 1); objMultipliertext.x = 850; objMultipliertext.y = 1250; objMultipliertext.visible = 0; // Set visibility to 0 at the start of the game objContactPoint = game.addChild(LK.getAsset('objContactPoint', { anchorX: 0.5, anchorY: 0.5, alpha: 0 })); objContactPoint.x = 1024; objContactPoint.y = 1366; // Create a text object to display the score var scoreText = new Text2('Score: 0', { size: 80, fill: "#ffffff", font: "Impact" }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var score = 0; scoreText.visible = true; // Reset visibility of score to 1 when game starts game.background13Active = false; // Flag to track if objBackground13 is active // Instantiate objStomach where objHungerFrame is and remove objHungerFrame from the playspace var head = game.addChild(LK.getAsset('objHead', { anchorX: 0.5, anchorY: 0.5 })); head.x = 1050; head.y = 2635; var objStar = game.addChildAt(LK.getAsset('objStar', { anchorX: 0.5, anchorY: 0.5 }), game.getChildIndex(head) - 1); objStar.x = head.x - 45; objStar.y = head.y - head.height / 2 - objStar.height / 2 + 235; ; game.down = function (x, y, obj) { if (!seagull.diving && !seagull.returning && (!crab || !crab.attached)) { seagull.diving = true; seagull.diveTime = 0; seagull.startX = seagull.x; seagull.startY = seagull.y; seagull.endX = seagull.startX + seagull.speed * seagull.direction * seagull.diveDuration / 2; } if (!gustSpawned && !gustCooldown) { var objGust = game.addChildAt(new ObjGust(), game.getChildIndex(seagull)); objGust.x = seagull.x; objGust.y = seagull.y; LK.setTimeout(function () { objGust.destroy(); }, 100); gustSpawned = true; gustCooldown = true; LK.setTimeout(function () { gustCooldown = false; }, 2000); } // Play a random sound (snoise, snoise02, snoise03) var sounds = ['SNoise', 'SNoise02', 'SNoise03']; var randomSound = sounds[Math.floor(Math.random() * sounds.length)]; LK.getSound(randomSound).play(); }; var pulsateInterval; var pulsateIntervalActive = false; // Track if pulsateInterval is active var shakeInterval;
===================================================================
--- original.js
+++ change.js
@@ -581,9 +581,9 @@
game.ObjToast = ObjToast;
// Animate ObjToast
var startX = 75;
var startY = 1150; // Start from the bottom of the screen
- var endX = 450;
+ var endX = Math.random() * (2048 - ObjToast.width) + ObjToast.width / 2;
var endY = 2090;
var duration = 60; // Duration of the animation in frames (1 second)
var currentFrame = 0;
ObjToast.x = startX;
@@ -879,13 +879,13 @@
}, (Math.random() * 10 + 10) * 1000); // Random interval between 10 to 20 seconds
var scaleDirectionRadio = 1;
var scaleDirectionDive = 1;
LK.setInterval(function () {
- // Unique pulsating effect for objRadio
- var scaleFactorRadio = 1 + scaleDirectionRadio * 0.05;
- objRadio.scale.x = scaleFactorRadio;
- objRadio.scale.y = scaleFactorRadio;
- if (scaleFactorRadio >= 1.2 || scaleFactorRadio <= 0.8) {
+ // Unique scaling for objRadio
+ var scaleFactorRadio = 1 + scaleDirectionRadio * 0.005;
+ objRadio.scale.x *= scaleFactorRadio;
+ objRadio.scale.y *= scaleFactorRadio;
+ if (objRadio.scale.x >= 1.15 || objRadio.scale.x <= 0.85) {
scaleDirectionRadio *= -1;
}
// Unique scaling for divetoeat
var scaleFactorDive = 1 + scaleDirectionDive * 0.01;
Create a cartoon-style illustration of the ocean and an empty sandy beach from the perspective of a person standing on the beach. The goal is to capture a lively and playful location.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of fries in a brown bag. The goal is to capture a lively and playful object. Front perspective. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of white drop of paint. The goal is to capture a lively and playful paint.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of white splash of paint. The goal is to capture a lively and playful paint. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a stomach The goal is to capture a lively and playful stomach... Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of palm trees. The goal is to capture a lively and playful location. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of beach rocks. The goal is to capture a lively and playful location. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a wooden no feeding and no littering sign on a sandy stake.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a speech bubble that is written I'm Hungry!. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a giant squid menacingly staring... Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of palm trees leaves.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a dark silhouette of a seaplane, side profile. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of smoke.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a mix of colorful music notes. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of a crab from the back. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of a sand cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of an explosion of stars. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of an speech bubble with the word "Yum!". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
make it more colorful in the top portion of the bricks
Create a cartoon-style illustration of a mix of a beach radio. Front View. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a close-up cartoon-style illustration of an dizzy seagull with his tongue sticking out on an empty sandy beach. The goal is to capture a lively and playful game over screen. Make sure 'game over' is written.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a close-up cartoon-style illustration of the letters "sos" in black. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a smiling face of a seagul with black shades with the words "Time Bonus" at the bottom of it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a cartoon-style illustration of a seagul's face chomping down on a slice of bread make it comical. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of an red girly angry emoji. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of a seagul's face chomping down on fries make it comical.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
create a cartoon-style illustration of a seagul's face chomping down on a fish make it comical.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
three words 'dive to eat' in a cartoonish style with an arrow pointing down. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.