User prompt
Fix Bug: 'ReferenceError: arenaCircle is not defined' in this line: 'var radius = arenaCircle.radius * Math.random();' Line Number: 6
User prompt
the coin has to appear inside the play area, which is defined by the circle around the paddle goes around and which alo happens to correspond to the area where the ball can bounce
User prompt
create a coin asset, that appears somewhere randomly isnide the play area, whenever the ball hits the paddle
User prompt
when the ball contacts the paddle, instead of awarding just 1 point, award 10 instead
User prompt
make the wow score appear once every 50 points instead of just 5
User prompt
change this from 1.01 to 1.005 " var speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y) * 1.01;"
User prompt
change this " }, 1500); } }, 1000 / 200); };" into this " }, 1500); } }, 1000 / 900); };"
User prompt
change this " }, 1000 / 600); }, 2000); " into this " }, 1000 / 900); }, 1500);"
User prompt
change this " }, 1000 / 600); }, 1000); " into this " }, 1000 / 600); }, 2000);"
User prompt
make the wowscore appear once every 5 points instead of 3
User prompt
change this" }, 1000 / 400); into " }, 1000 / 200);"
User prompt
change this" }, 1000 / 750); }, 1000); } }, 1000 / 750); };" into "}, 1000 / 600); }, 1000); } }, 1000 / 400); };" "
User prompt
change this " if (self.wowScore.y <= 3000 / 1.2) {" into this " if (self.wowScore.y <= 3000 / 1.25) {"
User prompt
change this " if (self.wowScore.y <= 3000 / 1.3) {" into this " if (self.wowScore.y <= 3000 / 1.2) {"
User prompt
change this " if (self.wowScore.y <= 3000 / 1.5) {" into this " if (self.wowScore.y <= 3000 / 1.3) {"
User prompt
change this " if (self.wowScore.y <= 3000 / 1.1) {" into this " if (self.wowScore.y <= 3000 / 1.5) {"
User prompt
change both the 2732 from here" if (self.wowScore.y <= 2732 / 1.1) { LK.clearInterval(slideUp); LK.setTimeout(function () { var slideDown = LK.setInterval(function () { self.wowScore.y += 100; if (self.wowScore.y >= 2732) { LK.clearInterval(slideDown); } }, 1000 / 750); }, 1000); } }, 1000 / 750);" into 3000
User prompt
change the value from this snippet "self.wowScore = self.createAsset('wowScore', 'WOW Score Graphics', 0.5, 0.5); self.wowScore.y = 2732; self.wowScore.x = 2048 / 2;" into this self.wowScore.y = 3000;
User prompt
change this "if (self.wowScore.y <= 2732 / 1.5) {" into this " if (self.wowScore.y <= 2732 / 1.1) {"
User prompt
change this "if (self.wowScore.y <= 2732 / 250) {" into this " if (self.wowScore.y <= 2732 / 1.5) {"
User prompt
change this "if (self.wowScore.y <= 2732 / 2) {" into this " if (self.wowScore.y <= 2732 / 250) {"
User prompt
change the 2 value too 250 " if (self.wowScore.y <= 2732 / 2) {"
User prompt
change this 2 to 200 " if (self.wowScore.y <= 2732 / 2) {"
User prompt
change this 10 to 2 " if (self.wowScore.y <= 2732 / 10) {"
User prompt
change this 10 to 100 " self.wowScore.y -= 10;"
var Coin = Container.expand(function (arenaCircle) { var self = Container.call(this); var coinGraphics = self.createAsset('coin', 'Coin Graphics', 0.5, 0.5); self.addChild(coinGraphics); var angle = Math.random() * 2 * Math.PI; var radius = arenaCircle.radius * Math.random(); self.x = 2048 / 2 + radius * Math.cos(angle); self.y = 2732 / 2 + radius * Math.sin(angle); }); var ArenaCircle = Container.expand(function () { var self = Container.call(this); self.radius = 2048 * 0.4; var circleGraphics = self.createAsset('arenaCircle', 'Arena Circle Graphics', 0.5, 0.5); var orbitLine = self.createAsset('orbitLine', 'Orbit Line Graphics', 0.5, 0.5); circleGraphics.width = self.radius * 2; circleGraphics.height = self.radius * 2; orbitLine.width = self.radius * 2; orbitLine.height = 10; orbitLine.alpha = 0; self.addChild(circleGraphics); self.addChild(orbitLine); self.x = 2048 / 2; self.y = 2732 / 2; }); var Ball = Container.expand(function (arenaRadius, paddle, game) { var self = Container.call(this); Ball.prototype.animateScoreText = function () { var originalScale = this.game.scoreTxt.scale.x; var targetScale = originalScale * 1.25; var expandDuration = 50; var contractDuration = 100; LK.setTimeout((function () { this.game.scoreTxt.scale.set(targetScale); }).bind(this), expandDuration); LK.setTimeout((function () { this.game.scoreTxt.scale.set(originalScale); }).bind(this), expandDuration + contractDuration); }; self.game = game; Ball.prototype.intersectsBounds = function (boundsA, boundsB) { return boundsA.x < boundsB.x + boundsB.width && boundsA.x + boundsA.width > boundsB.x && boundsA.y < boundsB.y + boundsB.height && boundsA.y + boundsA.height > boundsB.y; }; self.paddle = paddle; Ball.prototype.isCollidingWithArenaEdge = function (arenaCircle) { var dx = this.x - 2048 / 2; var dy = this.y - 2732 / 2; var distance = Math.sqrt(dx * dx + dy * dy); return distance + this.width / 2 > arenaCircle.radius; }; var ballGraphics = self.createAsset('ball', 'Ball Graphics', 0.5, 0.5); var angleToPaddle = Math.atan2(100 - 2732 / 2, 2048 / 2 - 2048 / 2); self.velocity = { x: 5 * Math.cos(angleToPaddle), y: 5 * Math.sin(angleToPaddle) }; self.radius = arenaRadius; self.move = function (arenaCircle) { this.applyVelocity(); if (this.isCollidingWithPaddle(this.paddle)) { this.bounceOffPaddle(this.paddle); } else if (this.isCollidingWithArenaEdge(arenaCircle)) { LK.showGameOver(); this.reset(); } this.x += this.velocity.x; this.y += this.velocity.y; }; Ball.prototype.applyVelocity = function () { var dx = this.x - 2048 / 2; var dy = this.y - 2732 / 2; var angle = Math.atan2(dy, dx); var speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y) * 1.005; angle += this.velocity.angleChange; LK.setTimeout((function () { this.x = 2048 / 2 + Math.cos(angle) * this.radius; this.y = 2732 / 2 + Math.sin(angle) * this.radius; }).bind(this), 1000); }; Ball.prototype.checkArenaCollision = function (paddle, arenaCircle) { if (this.isCollidingWithArenaEdge(arenaCircle)) { this.bounceOffArenaEdge(paddle.angle, paddle.speed); } else if (this.isCollidingWithPaddle(paddle)) { this.bounceOffPaddle(paddle); } }; Ball.prototype.isCollidingWithPaddle = function (paddle) { if (paddle) { if (paddle) { var paddleCenter = { x: paddle.x, y: paddle.y }; var ballCenter = { x: this.x, y: this.y }; var dx = paddleCenter.x - ballCenter.x; var dy = paddleCenter.y - ballCenter.y; var distance = Math.sqrt(dx * dx + dy * dy); return distance < paddle.width / 2 + this.width / 2; } } return false; }; Ball.prototype.bounceOffPaddle = function (paddle) { var angleToPaddleCenter = Math.atan2(paddle.y - this.y, paddle.x - this.x); var speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y) * 1.015; this.velocity.x = speed * Math.cos(angleToPaddleCenter + Math.PI); this.velocity.y = speed * Math.sin(angleToPaddleCenter + Math.PI); if (!this.hasScored) { this.game.score += 10; this.game.scoreTxt.setText(this.game.score.toString()); this.animateScoreText(); if (this.game.score % 50 === 0) { this.game.animateWowScore(); } this.hasScored = true; var coin = new Coin(); this.game.addChild(coin); if (!this.speedIncreased) { self.paddle.speed *= 1.015; this.speedIncreased = true; LK.setTimeout(function () { self.speedIncreased = false; }, 500); } else { self.paddle.speed *= 1.015; } } LK.setTimeout(function () { self.hasScored = false; }, 500); }; self.reset = function () { self.x = 2048 / 2; self.y = 2732 / 2; var initialAngle = self.paddle.angle; self.velocity = { x: 5 * Math.cos(initialAngle), y: 5 * Math.sin(initialAngle) }; }; }); var Paddle = Container.expand(function (arenaRadius) { var self = Container.call(this); var paddleGraphics = self.createAsset('paddle', 'Paddle Graphics', 0.5, 0.5); self.addChild(paddleGraphics); self.angle = Math.random() * 2 * Math.PI; self.radius = arenaRadius + 20; self.speed = 0.025; self.move = function () { this.updatePosition(); }; Paddle.prototype.updatePosition = function () { self.angle += self.speed; var cosAngle = Math.cos(self.angle); var sinAngle = Math.sin(self.angle); self.x = self.radius * cosAngle + 2048 / 2; self.y = self.radius * sinAngle + 2732 / 2; paddleGraphics.rotation = self.angle + Math.PI / 2 + Math.PI / 2 - Math.PI / 9 - Math.PI / 18; }; self.reverseDirection = function () { self.speed *= -1; }; }); var Game = Container.expand(function () { var self = Container.call(this); self.score = 0; self.scoreTxt = new Text2(self.score.toString(), { size: 227.8125 * 0.9, fill: "#ffffff", stroke: "#075079", strokeThickness: 11.25, font: "'Luckiest Guy', 'Arial Black', sans-serif" }); self.scoreTxt.anchor.set(0.5, 0.5); self.scoreTxt.x = 2048 / 2; var arenaCircle = self.addChild(new ArenaCircle()); self.scoreTxt.y = 2732 / 2 + 5; LK.stageContainer.setBackgroundColor(0xFFFFFF); var background = self.createAsset('background', 'Background Graphics', 0.5, 0.5); background.width = 2048; background.height = 2732; background.x = 2048 / 2; background.y = 2732 / 2; self.addChildAt(background, 0); var arenaCircle = self.addChild(new ArenaCircle()); self.wowScore = self.createAsset('wowScore', 'WOW Score Graphics', 0.5, 0.5); self.wowScore.y = 3000; self.wowScore.x = 2048 / 2; var paddle = self.addChild(new Paddle(arenaCircle.radius)); paddle.x = 2048 / 2; paddle.y = 100; self.addChild(self.scoreTxt); var ball = self.addChild(new Ball(arenaCircle.radius, paddle, self)); ball.reset(); var isGameOver = false; LK.on('tick', function () { paddle.move(); ball.move(arenaCircle); }); self.animateWowScore = function () { var slideUp = LK.setInterval(function () { self.wowScore.y -= 100; if (self.wowScore.y <= 3000 / 1.25) { LK.clearInterval(slideUp); LK.setTimeout(function () { var slideDown = LK.setInterval(function () { self.wowScore.y += 100; if (self.wowScore.y >= 3000) { LK.clearInterval(slideDown); } }, 1000 / 900); }, 1500); } }, 1000 / 900); }; stage.on('down', function (obj) { paddle.reverseDirection(); }); });
===================================================================
--- original.js
+++ change.js
@@ -1,5 +1,5 @@
-var Coin = Container.expand(function () {
+var Coin = Container.expand(function (arenaCircle) {
var self = Container.call(this);
var coinGraphics = self.createAsset('coin', 'Coin Graphics', 0.5, 0.5);
self.addChild(coinGraphics);
var angle = Math.random() * 2 * Math.PI;
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. top-down. seen from above. curling stone
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. top-down. seen from above. colored curling stone
game background. In-Game asset. 2d. vector illustration. High contrast. No shadows. top-down. winter curling Olympics
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. round curling ice ring. top-down. seen from above
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. board panel. WOW text
a banner displaying the text WOW Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
golden radial liquid cartoony puffed explosion. pixelated. 8 bit.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
round frozen golden curling ball seen from above. text (+2) inscribed on it. sylized.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.