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
var Urchin = Container.expand(function () { var self = Container.call(this); var urchinGraphics = self.createAsset('urchinWithSpikes', 'Urchin character with spikes', .5, .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.pushCooldown <= 0 && !this.stunned) { this.hasPushed = true; this.pushCooldown = 60; 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; } }; }); 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.createAsset('fish', 'Fish character', .5, .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 < 500) { 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 BubbleSpawner = Container.expand(function () { var self = Container.call(this); return self; }); var Game = Container.expand(function () { var self = Container.call(this); var bubbleSpawner = self.addChild(new BubbleSpawner()); var background = self.createAsset('background', 'Game background', 0.5, 0.5); background.alpha = 0.5; background.x = 2048 / 2; background.y = 2732 / 2; self.addChildAt(background, 0); LK.stageContainer.setBackgroundColor(0x000000); var urchin = self.addChild(new Urchin()); var fishes = []; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); urchin.x = 2048 / 2; urchin.y = 2732 / 2; var dragNode = null; stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); 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(self); if (dragNode) { dragNode.x = pos.x; dragNode.y = pos.y; } } stage.on('move', handleMove); stage.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.01); } 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(); } } } } if (Math.random() < 0.01 && 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 { 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); self.addChild(newFish); } }); });
===================================================================
--- original.js
+++ change.js
@@ -35,11 +35,13 @@
this.scale.set(2);
}
};
self.stun = function () {
- this.stunDuration = 60;
- this.stunned = true;
- this.rotationSpeed = 2 * Math.PI / this.stunDuration;
+ if (this.scale.x <= 1) {
+ this.stunDuration = 60;
+ this.stunned = true;
+ this.rotationSpeed = 2 * Math.PI / this.stunDuration;
+ }
};
});
var Fish = Container.expand(function () {
var self = Container.call(this);
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.