Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Shape.hsvToRgb is not a function' in this line: 'var bgColor = Shape.hsvToRgb(1, 1, 1);' Line Number: 156
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
use only circle graphics for shapes and staticshapes
Code edit (1 edits merged)
Please save this source code
User prompt
make on tick check if player has clicked AND all children of shapes have isscaling=false
User prompt
set a boolean flag indicating whether any scaleup or scaledown events are happening
Code edit (3 edits merged)
Please save this source code
User prompt
check for level complete in on tick
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in this line: 'collisionText.style.fill = '#ff0000';' Line Number: 163
User prompt
if (isClicked && noCollided) { in on tick - make explodede text red
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: LK.pauseGame is not a function' in this line: 'LK.pauseGame();' Line Number: 172
User prompt
if nocollided true in on tick, pause game and display text: 'intermission'
Code edit (1 edits merged)
Please save this source code
User prompt
in lk on tick check if all children og type shape or static shape have iscollided set to false
User prompt
if no shapes have isCollided true, check whether collisionCount matches the required number of collisions for the current level. If it does, continue to next level, otherwise, give an option to play the same level again.
User prompt
make an array of 20 game levels, each with more total shapes and a higher number for required collisions to complete that level
User prompt
the stage on down handler should only allow one click from player
User prompt
Fix Bug: 'ReferenceError: collisionCount is not defined' in this line: 'collisionCount++;' Line Number: 142
User prompt
display the collisionscount in a text instance on screen: 'Exploded: ' + collisionCount;
Code edit (2 edits merged)
Please save this source code
User prompt
when shapes scale up, their collision area should scale up as well
===================================================================
--- original.js
+++ change.js
@@ -65,8 +65,47 @@
case 'square':
shapeGraphics = LK.getAsset('square', 'Square Shape', 0.5, 0.5);
break;
}
+ self.hsvToRgb = function (h, s, v) {
+ var r, g, b;
+ var i = Math.floor(h * 6);
+ var f = h * 6 - i;
+ var p = v * (1 - s);
+ var q = v * (1 - f * s);
+ var t = v * (1 - (1 - f) * s);
+ switch (i % 6) {
+ case 0:
+ (r = v, g = t, b = p);
+ break;
+ case 1:
+ (r = q, g = v, b = p);
+ break;
+ case 2:
+ (r = p, g = v, b = t);
+ break;
+ case 3:
+ (r = p, g = q, b = v);
+ break;
+ case 4:
+ (r = t, g = p, b = v);
+ break;
+ case 5:
+ (r = v, g = p, b = q);
+ break;
+ }
+ return (r * 255 << 16) + (g * 255 << 8) + b * 255;
+ };
+ self.updateColor = function () {
+ var h = self.colorIndex / 32;
+ var s = 0.8;
+ var v = 0.8;
+ self.color = self.hsvToRgb(h, s, v);
+ shapeGraphics.tint = self.color;
+ self.colorIndex = (self.colorIndex + 1) % 32;
+ };
+ self.colorIndex = Math.floor(Math.random() * 32);
+ self.updateColor();
self.addChild(shapeGraphics);
var angle = Math.random() * Math.PI * 2;
var speed = 5;
self.vx = Math.cos(angle) * speed;
@@ -132,9 +171,9 @@
collisionText.x = 0;
collisionText.y = 250;
LK.gui.topCenter.addChild(levelText);
LK.gui.topCenter.addChild(collisionText);
- for (var i = 0; i < 5; i++) {
+ for (var i = 0; i < 15; i++) {
var shape = self.addChild(new Shape());
shape.x = Math.random() * (1024 - shape.width);
shape.y = Math.random() * (1366 - shape.height);
shapes.push(shape);
a white geometric square shape Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a white dot Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
flat white round disk Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
gif circle spinning animation Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.