User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(this.game.scoreTxt.text, 10);' Line Number: 40
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 40
User prompt
Fix Bug: 'TypeError: this.game.scoreTxt.getText is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.getText(), 10);' Line Number: 40
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 40
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(this.game.scoreTxt.text, 10);' Line Number: 40
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 40
User prompt
now let's fix the score. the score has to increment by 1 whenever the ball hits the paddle
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(this.game.scoreTxt.text, 10);' Line Number: 78
User prompt
so remember when I told you to rotate the paddle by 10 degrees to the left? I need you to rotate it once again also by 10 degrees to the left. just rotate the paddle art asset, this has nothing to do with how it's moving, it's just rotating the graphic 10 degrees to the left.
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
so remember when I told you to rotate the paddle by 10 degrees to the left? I need you to rotate it once again also by 10 degrees to the left. just rotate the paddle art asset, this has nothing to do with how it's moving, it's just rotating the graphic 10 degrees to the left.
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
so remember when I told you to rotate the paddle by 90 degrees to the right? it was actually too much, I need you to now rotate is 10 degrees to the left. just rotate the paddle art asset, this has nothing to do with how it's moving, it's just rotating the graphic 10 degrees to the left
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
actually rotate the paddle 10 degrees to the left
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(this.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var currentScore = parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var currentScore = window.parseInt(self.game.scoreTxt.text, 10);' Line Number: 78
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.tint = 0xFFFFFF; 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); 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); var currentScore = parseInt(this.game.scoreTxt.text, 10); this.game.scoreTxt.setText((currentScore + 1).toString()); } 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); angle += this.velocity.angleChange; this.x = 2048 / 2 + Math.cos(angle) * this.radius; this.y = 2732 / 2 + Math.sin(angle) * this.radius; }; 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 paddleBounds = paddle.getBounds(); var ballBounds = this.getBounds(); return paddleBounds && ballBounds && this.intersectsBounds(paddleBounds, ballBounds); } } 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); this.velocity.x = speed * Math.cos(angleToPaddleCenter + Math.PI); this.velocity.y = speed * Math.sin(angleToPaddleCenter + Math.PI); }; self.reset = function () { self.x = 2048 / 2; self.y = 2732 / 2; var initialAngle = Math.random() * 2 * Math.PI; 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 = 0; self.radius = arenaRadius; self.speed = 0.05; 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.updateScore = function (hit) { if (hit) { var currentScore = scoreTxt.text ? parseInt(scoreTxt.text.toString(), 10) : 0; scoreTxt.setText((currentScore + 1).toString()); } }; LK.stageContainer.setBackgroundColor(0x000000); var arenaCircle = self.addChild(new ArenaCircle()); var paddle = self.addChild(new Paddle(arenaCircle.radius)); paddle.x = 2048 / 2; paddle.y = 100; var ball = self.addChild(new Ball(arenaCircle.radius, paddle, self)); ball.reset(); self.scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); self.scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(self.scoreTxt); var isGameOver = false; LK.on('tick', function () { paddle.move(); ball.move(arenaCircle); }); stage.on('down', function (obj) { paddle.reverseDirection(); }); });
===================================================================
--- original.js
+++ change.js
@@ -36,9 +36,9 @@
self.move = function (arenaCircle) {
this.applyVelocity();
if (this.isCollidingWithPaddle(this.paddle)) {
this.bounceOffPaddle(this.paddle);
- var currentScore = window.parseInt(this.game.scoreTxt.text, 10);
+ var currentScore = parseInt(this.game.scoreTxt.text, 10);
this.game.scoreTxt.setText((currentScore + 1).toString());
} else if (this.isCollidingWithArenaEdge(arenaCircle)) {
LK.showGameOver();
this.reset();
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.