/**** * Classes ****/ var ArenaCircle = Container.expand(function () { var self = Container.call(this); self.radius = 2048 * 0.4; var circleGraphics = self.attachAsset('arenaCircle', { anchorX: 0.5, anchorY: 0.5 }); var orbitLine = self.attachAsset('orbitLine', { anchorX: 0.5, anchorY: 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.attachAsset('ball', { anchorX: 0.5, anchorY: 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_migrated = 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; this.game.collectCoin(this); }; 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) { var previousScore = this.game.score; this.game.score += 1; this.game.scoreTxt.setText(this.game.score.toString()); this.animateScoreText(); var newScore = this.game.score; if (Math.floor(newScore / 10) > Math.floor(previousScore / 10)) { this.game.animateWowScore(); } this.hasScored = true; if (!this.speedIncreased) { self.paddle.speed *= 1.005; this.speedIncreased = true; LK.setTimeout(function () { self.speedIncreased = false; }, 500); } else { self.paddle.speed *= 1.005; } // Play the 'Hit' sound when the ball hits the paddle LK.getSound('Hit').play(); } 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 BonusArea = Container.expand(function () { var self = Container.call(this); var bonusAreaGraphics = self.attachAsset('bonusArea', { anchorX: 0.5, anchorY: 0.5 }); bonusAreaGraphics.alpha = 0; self.addChild(bonusAreaGraphics); self.x = 2048 / 2; self.y = 2732 / 2; }); var Coin = Container.expand(function (bonusArea) { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(coinGraphics); self.placeRandomly = function () { var padding = 200; var minX = bonusArea.x - bonusArea.width / 2 + coinGraphics.width / 2 + padding; var maxX = bonusArea.x + bonusArea.width / 2 - coinGraphics.width / 2 - padding; var minY = bonusArea.y - bonusArea.height / 2 + coinGraphics.height / 2 + padding; var maxY = bonusArea.y + bonusArea.height / 2 - coinGraphics.height / 2 - padding; self.x = Math.random() * (maxX - minX) + minX; self.y = Math.random() * (maxY - minY) + minY; }; self.placeRandomly(); }); var CoinExplosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.attachAsset('coinExplosion', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(explosionGraphics); self.animate = function () { LK.setTimeout(function () { self.destroy(); }, 100); }; }); var Paddle = Container.expand(function (arenaRadius) { var self = Container.call(this); var paddleGraphics = self.attachAsset('paddle', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(paddleGraphics); self.angle = Math.random() * 2 * Math.PI; self.radius = arenaRadius + 20; self.speed = 0.035; self._move_migrated = 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; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.score = 0; game.scoreTxt = new Text2(game.score.toString(), { size: 227.8125 * 0.9, fill: 0xFFFFFF, stroke: 0x075079, strokeThickness: 11.25, font: "'Luckiest Guy', 'Arial Black', sans-serif" }); game.scoreTxt.anchor.set(0.5, 0.5); game.scoreTxt.x = 2048 / 2; game.scoreTxt.y = 2732 / 2 + 5; // Add "by axtra remixed" text at the top game.creditTxt = new Text2("by axtra remixed", { size: 300, fill: 0x000000, font: "'Arial', sans-serif" }); game.creditTxt.anchor.set(0.5, 0); game.creditTxt.x = 2048 / 2; game.creditTxt.y = 150; var bonusArea = game.addChild(new BonusArea()); var coin = game.addChild(new Coin(bonusArea)); game.collectCoin = function (ball) { if (ball.intersects(coin)) { var explosion = game.addChild(new CoinExplosion()); explosion.x = coin.x; explosion.y = coin.y; explosion.animate(); coin.placeRandomly(); game.score += 2; game.scoreTxt.setText(game.score.toString()); ball.animateScoreText(); var newScore = game.score; if (Math.floor(newScore / 10) > Math.floor((newScore - 2) / 10)) { game.animateWowScore(); } // Play the 'collectGold' sound when the coin is collected LK.getSound('collectGold').play(); } }; game.scoreTxt.anchor.set(0.5, 0.5); game.scoreTxt.x = 2048 / 2; var arenaCircle = game.addChild(new ArenaCircle()); game.scoreTxt.y = 2732 / 2 + 5; game.setBackgroundColor(0xFFFFFF); var background = game.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); background.width = 2048; background.height = 2732; background.x = 2048 / 2; background.y = 2732 / 2; game.addChildAt(background, 0); var bonusArea = game.addChild(new BonusArea()); game.wowScore = game.attachAsset('wowScore', { anchorX: 0.5, anchorY: 0.5 }); game.wowScore.y = 3000; game.wowScore.x = 2048 / 2; var paddle = game.addChild(new Paddle(arenaCircle.radius)); paddle.x = 2048 / 2; paddle.y = 100; game.addChild(game.scoreTxt); game.addChild(game.creditTxt); var ball = game.addChild(new Ball(arenaCircle.radius, paddle, game)); ball.reset(); game.addChild(coin); var isGameOver = false; LK.playMusic('Background'); LK.on('tick', function () { paddle._move_migrated(); ball._move_migrated(arenaCircle); }); game.animateWowScore = function () { var slideUp = LK.setInterval(function () { game.wowScore.y -= 100; if (game.wowScore.y <= 3000 / 1.25) { LK.clearInterval(slideUp); // Play the 'WOW' sound effect when the WOW element appears LK.getSound('WOW').play(); LK.setTimeout(function () { var slideDown = LK.setInterval(function () { game.wowScore.y += 100; if (game.wowScore.y >= 3000) { LK.clearInterval(slideDown); } }, 1000 / 900); }, 1500); } }, 1000 / 900); }; game.on('down', function (x, y, obj) { paddle.reverseDirection(); // Play the 'Paddle' sound when the paddle switches direction LK.getSound('Paddle').play(); });
===================================================================
--- original.js
+++ change.js
@@ -237,10 +237,10 @@
game.scoreTxt.x = 2048 / 2;
game.scoreTxt.y = 2732 / 2 + 5;
// Add "by axtra remixed" text at the top
game.creditTxt = new Text2("by axtra remixed", {
- size: 60,
- fill: 0x666666,
+ size: 300,
+ fill: 0x000000,
font: "'Arial', sans-serif"
});
game.creditTxt.anchor.set(0.5, 0);
game.creditTxt.x = 2048 / 2;
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.