User prompt
move wow graphic closer right to the congrats graphic
User prompt
align the wow graphic to the top left of the congrats graphic
User prompt
show wow graphic left of the congrats graphic and show for the same length of time
User prompt
change congrats graphic so that it only appears in the bottom right of screen at 700 x 790
User prompt
display congrats graphic at 386 x 435.87
User prompt
for congrats graphic It might be helpful to store the original state of the graphic before applying any animations. This way, you can easily revert the graphic back to this state once the animation is no longer needed.
User prompt
remove animation from congratualtions graphics
User prompt
animate the congraphics graphic so that is rocks back at forth on a center axis while visible.
User prompt
when point tally reaches a multiple of 10 (so 10, 20, 30, 40, etc.) show congrats graphic for 3 seconds then destroy graphic.
User prompt
Instead of setting the fish's movement direction only once based on initial conditions, continuously evaluate their position and adjust their movement dynamically. This could involve periodically changing their target position or direction to keep them actively moving within the game area.
User prompt
when urchin collects food, update the point tally at top of screen. increase number by one
User prompt
change the food code so that the food only generates at top screen before drifting down
User prompt
the food drifts slowly down from the top of the screen. once it hits the bottom screen destroy graphic
User prompt
create a start button for beginning of game. game does not start until player pushes start button. when start button is pushed is disappears.
User prompt
limit the amount of food that can be on the screen at one time to 20 food.
User prompt
points tally at the top of screen goes up by one when urchin collects food
User prompt
create icon for "food". food is generated randomly on the screen. food dissappears once urchin collects it.
User prompt
shrunk hit box for fish by 20%
User prompt
Elimaite cooldown after expand
User prompt
Reduce hit box for fish by 15%
User prompt
Increase the speed that urchin decreases after expand
User prompt
Urchin cannot get stunned while expanded
User prompt
In trade size of expand by 100%
User prompt
Implement suggestions above
/**** * Classes ****/ var BubbleSpawner = Container.expand(function () { var self = Container.call(this); return self; }); var Fish = Container.expand(function () { var self = Container.call(this); Fish.prototype.pushAway = function (urchin) { this.pushed = true; this.pushDirection = { x: this.x - urchin.x, y: this.y - urchin.y }; var pushMagnitude = Math.sqrt(this.pushDirection.x * this.pushDirection.x + this.pushDirection.y * this.pushDirection.y); this.pushDirection.x /= pushMagnitude; this.pushDirection.y /= pushMagnitude; }; var fishGraphics = self.attachAsset('fish', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.move = function (urchinX, urchinY) { var dx = urchinX - this.x; var dy = urchinY - this.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 340) { var directionX = dx > 0 ? 1 : -1; var directionY = dy > 0 ? 1 : -1; this.x -= this.speed * directionX; this.y -= this.speed * directionY; fishGraphics.scale.x = -directionX; } }; }); var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1; self.move = function () { this.y += this.speed; }; }); var StartButton = Container.expand(function () { var self = Container.call(this); var startButtonGraphics = self.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); }); var Urchin = Container.expand(function () { var self = Container.call(this); var urchinGraphics = self.attachAsset('urchinWithSpikes', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.move = function (deltaX, deltaY) { var inertia = 0.95; var maxSpeed = 5; this.vx = (this.vx || 0) * inertia + deltaX * 0.05; this.vy = (this.vy || 0) * inertia + deltaY * 0.05; this.vx = Math.sign(this.vx) * Math.min(Math.abs(this.vx), maxSpeed); this.vy = Math.sign(this.vy) * Math.min(Math.abs(this.vy), maxSpeed); if (!this.stunned) { this.x += this.vx; this.y += this.vy; } else if (this.stunDuration > 0) { this.rotation += this.rotationSpeed; this.stunDuration--; if (this.stunDuration <= 0) { this.stunned = false; this.rotation = 0; this.vx = 0; this.vy = 0; if (this.scale.x > 1) { this.scale.set(1); } } } }; self.pushCooldown = 0; self.stunDuration = 0; self.stunned = false; self.hasPushed = false; self.push = function () { if (!this.stunned) { this.hasPushed = true; this.scale.set(2); } }; self.stun = function () { if (this.scale.x <= 1) { this.stunDuration = 60; this.stunned = true; this.rotationSpeed = 2 * Math.PI / this.stunDuration; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var bubbleSpawner = game.addChild(new BubbleSpawner()); var background = game.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); background.alpha = 0.5; background.x = 2048 / 2; background.y = 2732 / 2; game.addChildAt(background, 0); game.setBackgroundColor(0x000000); var urchin = game.addChild(new Urchin()); var startButton = game.addChild(new StartButton()); startButton.x = 2048 / 2; startButton.y = 2732 / 2; var fishes = []; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.top.addChild(scoreTxt); urchin.x = 2048 / 2; urchin.y = 2732 / 2; var dragNode = null; startButton.on('down', function (obj) { startButton.destroy(); game.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(game); var distance = Math.sqrt(Math.pow(pos.x - urchin.x, 2) + Math.pow(pos.y - urchin.y, 2)); if (distance <= urchin.width / 2) { dragNode = urchin; } else { urchin.push(); } }); function handleMove(obj) { var event = obj.event; var pos = event.getLocalPosition(game); if (dragNode) { dragNode.x = pos.x; dragNode.y = pos.y; } } game.on('move', handleMove); }); game.on('up', function (obj) { dragNode = null; urchin.scale.set(1); }); LK.on('tick', function () { urchin.move(); if (urchin.pushCooldown > 0) { urchin.pushCooldown--; if (urchin.scale.x > 1) { urchin.scale.set(urchin.scale.x - 0.02); } } for (var i = game.children.length - 1; i >= 0; i--) { var child = game.children[i]; if (child instanceof Food) { child.move(); if (child.y > 2732) { child.destroy(); } else if (urchin.intersects(child)) { child.destroy(); LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore().toString()); // Check if score is a multiple of 10 and show congrats graphic if (LK.getScore() % 10 === 0) { var congratsGraphic = LK.getAsset('congrats', { width: 500, height: 300, id: 'congratsGraphicId' }); congratsGraphic.x = 2048 / 2; congratsGraphic.y = 2732 / 2; game.addChild(congratsGraphic); // Destroy congrats graphic after 3 seconds without animation LK.setTimeout(function () { congratsGraphic.destroy(); }, 3000); } } } } for (var i = 0; i < fishes.length; i++) { fishes[i].move(urchin.x, urchin.y); if (urchin.intersects(fishes[i])) { if (!urchin.stunned) { if (urchin.hasPushed && !fishes[i].pushed) { fishes[i].pushAway(urchin); scoreTxt.text = (Number(scoreTxt.text) + 1).toString(); urchin.hasPushed = false; } else if (!urchin.hasPushed) { urchin.stun(); } } } } var foodCount = game.children.filter(function (child) { return child instanceof Food; }).length; if (Math.random() < 0.01 && foodCount < 20) { var newFood = new Food(); newFood.x = Math.random() * 2048; newFood.y = 0; game.addChild(newFood); } if (fishes.length < 20) { var newFish = new Fish(); var side = Math.floor(Math.random() * 4); var targetX, targetY; switch (side) { case 0: newFish.x = -100; newFish.y = Math.random() * 2732; targetX = 2048 + 100; targetY = newFish.y; break; case 1: newFish.x = Math.random() * 2048; newFish.y = -100; targetX = newFish.x; targetY = 2732 + 100; break; case 2: newFish.x = 2048 + 100; newFish.y = Math.random() * 2732; targetX = -100; targetY = newFish.y; break; case 3: newFish.x = Math.random() * 2048; newFish.y = 2732 + 100; targetX = newFish.x; targetY = -100; break; } newFish.move = function () { if (this.pushed) { this.x += this.pushDirection.x * 20; this.y += this.pushDirection.y * 20; if (this.x < -100 || this.x > 2148 || this.y < -100 || this.y > 2832) { this.destroy(); } } else { // Dynamically update target position if fish reaches current target if (Math.abs(this.x - targetX) < 10 && Math.abs(this.y - targetY) < 10) { // Choose new target position within game boundaries targetX = Math.random() * 2048; targetY = Math.random() * 2732; } var dx = targetX - this.x; var dy = targetY - this.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { var angle = Math.atan2(dy, dx); this.x += Math.cos(angle) * this.speed; this.y += Math.sin(angle) * this.speed; } } }; fishes.push(newFish); game.addChild(newFish); } });
===================================================================
--- original.js
+++ change.js
@@ -189,21 +189,12 @@
});
congratsGraphic.x = 2048 / 2;
congratsGraphic.y = 2732 / 2;
game.addChild(congratsGraphic);
- var rockDuration = 3000; // Duration to rock back and forth
- var rockCount = 6; // Number of times to rock back and forth
- var rockInterval = rockDuration / rockCount; // Interval for each rock
- for (var i = 0; i < rockCount; i++) {
- LK.setTimeout(function () {
- congratsGraphic.rotation += (i % 2 == 0 ? -1 : 1) * 0.1; // Alternate rotation direction
- }, rockInterval * i);
- }
- // Reset rotation and destroy congrats graphic after 3 seconds
+ // Destroy congrats graphic after 3 seconds without animation
LK.setTimeout(function () {
- congratsGraphic.rotation = 0;
congratsGraphic.destroy();
- }, rockDuration);
+ }, 3000);
}
}
}
}
Sea urchin, cartoon, spiny, long spines, grumpy face, no shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fish, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
underwater, ocean, anime landscape Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bubble, opaque, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A tender morsel of delicious plankton. cartoon, shiny, no background. bright orange and yellow shrimp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Game start sign. cartoon, shiny, underwater theme. "START GAME". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
game success graphic, surprised cartoon shiny words, "WOW!". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.