User prompt
set light type on1 6B7187
User prompt
Set light type on2 to be 888FA2 tint
Code edit (4 edits merged)
Please save this source code
User prompt
randomize each squarewhite's light type
User prompt
set light type on1 to be 494F69 tint
User prompt
Set light type on2 to be 80879B tint
User prompt
add 2 more light types - on2 and on1
User prompt
Rename Light type ON to on3
User prompt
Assign each SquareWhite a variable of its position based on its position in its grid, from 1 in top left corner, to 36 in bottom right corner
Code edit (2 edits merged)
Please save this source code
User prompt
When light type is ON, set SquareWhite's tint to EDF8FF. when its OFF, set its tint to 223A49
Code edit (1 edits merged)
Please save this source code
User prompt
Light type can only have 2 states: on and off. set it to off by default
User prompt
For SquareWhite class, add a variable: Light type
Code edit (1 edits merged)
Please save this source code
User prompt
Set score to 0
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ItemFull is not defined' in or related to this line: 'var itemFullCenter = new ItemFull();' Line Number: 292
User prompt
Remove everything related to ItemPlace, newitem, item full
User prompt
When player drags ItemFull, make that ItemFull and all its contents appear above all other ItemFulls
User prompt
Make ItemFull's part of the UI
User prompt
When square white is filled, disallow alligning any more ItemFull with it
User prompt
When alligning Item Full with SquareWhite, set that SquareWhite to filled
User prompt
Move it 140 pixels instead
User prompt
Okay, move ItemFull 278/2 pixels lower when its position is being assigned after beint let go of by the player
/**** * Classes ****/ var SquareWhite = Container.expand(function () { var self = Container.call(this); var lightTypes = ['off', 'on1', 'on2', 'on3']; self.LightType = lightTypes[Math.floor(Math.random() * lightTypes.length)]; var squareAsset = self.attachAsset('SquareWhite', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.112 * 1.08 * 1.05 * 1.08 * 1.05, scaleY: 2.112 * 1.08 * 1.05 * 1.08 * 1.05, alpha: 1, tint: self.LightType === 'on3' ? 0xEDF8FF : self.LightType === 'on2' ? 0x888FA2 : self.LightType === 'on1' ? 0x6B7187 : 0x121636 }); }); var WhiteRectangle = Container.expand(function () { var self = Container.call(this); var rectangleAsset = self.attachAsset('WhiteRectangle', { anchorX: 0.5, anchorY: 0.5 }); rectangleAsset.scale.set(0.25, 0.7); self.targetScale = Math.random() * 1.5; self.update = function () { rectangleAsset.scale.x += (self.targetScale - rectangleAsset.scale.x) * 0.02; if (Math.abs(rectangleAsset.scale.x - self.targetScale) < 0.005) { self.targetScale = Math.random() * 1.5; } }; }); /**** * Initialize Game ****/ // Create an array to hold the random numbers //<Assets used in the game will automatically appear here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var painterBackground = LK.getAsset('PainterBackground', { anchorX: 0.5, anchorY: 1, x: 2048 / 2, y: 2732 - 15 + 15 + 400 - 100 + 50, width: 2048 * 0.9 * 0.95, height: 800 * 1.3 * 1.5, alpha: 1 }); game.addChild(painterBackground); var randomNumberTexts = []; for (var i = 0; i < 50; i++) { // Create a new Text2 object to display the random number var randomNumberText = new Text2(Math.floor(Math.random() * 10).toString(), { size: 40, fill: 0x4A73B5, font: "Courier New" }); randomNumberText.anchor.set(0.5, 0.5); randomNumberText.x = 2048 / 50 * i; randomNumberText.y = 2732 / 2 + 930; game.addChild(randomNumberText); randomNumberTexts.push(randomNumberText); } // Add an update function to the game to move the numbers to the left game.update = function () { for (var i = 0; i < randomNumberTexts.length; i++) { randomNumberTexts[i].x -= 5; if (randomNumberTexts[i].x < 0) { randomNumberTexts[i].x = 2048; } } }; // Add Concrete as a background to all other items var concreteBackground = LK.getAsset('Concrete', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, width: 2048, height: 2732, alpha: 1, tint: 0x98bee3 }); game.addChildAt(concreteBackground, 0); // Add ScoreBack behind the score and make it around 1/3 screen long // Add score on top of the screen var scoreTxt = new Text2('0', { size: 135, fill: 0xFFFFFF, font: "Helvetica" }); var scoreBack = LK.getAsset('ScoreBack', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 20 + 75 - 35 + 20 + 40, width: 2048 / 3 * 0.85 * 0.85 * 1.2 * 1.3 * 1.1, height: 150 * 1.3 * 1.3 * 1.4 * 1.2 * 0.85 * 1.2 * 1.3 * 1.3 * 1.1 * 1.2, alpha: 1 }); game.addChild(scoreBack); // Add an update function to the game to move the numbers to the left game.update = function () { for (var i = 0; i < randomNumberTexts.length; i++) { randomNumberTexts[i].x -= 5; if (randomNumberTexts[i].x < 0) { randomNumberTexts[i].x = 2048; } } }; // Add PainterBackground at the bottom of the screen, above ConcreteBackground var painterBackground = LK.getAsset('PainterBackground', { anchorX: 0.5, anchorY: 1, x: 2048 / 2, y: 2732 - 15 + 15 + 400 - 100 + 50, width: 2048 * 0.9 * 0.95, height: 800 * 1.3 * 1.5, alpha: 1 }); game.addChild(painterBackground); // Generate String Of Numbers var randomNumberTexts = []; for (var i = 0; i < 50; i++) { // Create a new Text2 object to display the random number var randomNumberText = new Text2(Math.floor(Math.random() * 10).toString(), { size: 40, fill: 0x4A73B5, font: "Courier New" }); randomNumberText.anchor.set(0.5, 0.5); randomNumberText.x = 2048 / 50 * i; randomNumberText.y = 2732 / 2 + 930; game.addChild(randomNumberText); randomNumberTexts.push(randomNumberText); } // Add brown board to the game var brownBoardWidth = 400; // Define the width of the BrownBoard asset var brownBoardHeight = 400; // Define the height of the BrownBoard asset var brownBoard = LK.getAsset('BrownBoard', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 - 30, scaleX: 2048 / brownBoardWidth, scaleY: (6 / 1.5 * 1.1 * 1.1 * 0.95 * brownBoardHeight + 30) / brownBoardHeight, alpha: 1 }); // Add main background to the game var background = LK.getAsset('Background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + 20, y: 2732 / 2, width: 2068 * 1.05, height: 2000, alpha: 1 }); game.addChild(brownBoard); game.addChild(background); // Add gridBack behind the grid, but above Background var gridBack = LK.getAsset('GridBack', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 - 5, y: 2732 / 2 - 20, width: 1400 * 1.2 + 5, height: 1400 * 1.1 * 1.1 - 10, alpha: 1 }); game.addChild(gridBack); // Initialize a 6x6 grid of SquareWhite in the middle of the screen var grid = []; var gridSize = 6; var squareSize = 225.28 * 1.08 * 1.08 * 1.05; // Increase the size of the grid by an additional 5% var startX = (2048 - gridSize * squareSize) / 2 + 110 + 20; var startY = (2732 - gridSize * squareSize) / 2 + 90 + 20 + 5; for (var i = 0; i < gridSize; i++) { for (var j = 0; j < gridSize; j++) { var square = new SquareWhite(); square.x = startX + i * squareSize; square.y = startY + j * squareSize; square.positionInGrid = i * gridSize + j + 1; // Assign position based on grid game.addChild(square); grid.push(square); } } // Create 6 WhiteCircle instances and stack them on top of each other in the middle of the screen for (var i = 0; i < 6; i++) { var whiteCircle = LK.getAsset('WhiteCircle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 - 910, y: 2732 / 2 + i * 300 - 730 - 20 - 5, width: 31.5, height: 31.5, tint: 0x34dbeb }); game.addChild(whiteCircle); // Add a randomiser to change the brightness of each WhiteCircle every 1-5 seconds (function (whiteCircle) { var _changeBrightness = function changeBrightness() { var randomTime = Math.random() * 5000 + 3000; // Random time between 3-8 seconds whiteCircle.alpha = 0.2; // Change brightness to 20% LK.setTimeout(function () { whiteCircle.alpha = 1; // Revert brightness back LK.setTimeout(_changeBrightness, randomTime); // Schedule next brightness change }, randomTime); }; _changeBrightness(); // Start changing brightness })(whiteCircle); } // Add score on top of the screen var scoreTxt = new Text2('0', { size: 160, fill: 0x67BAEB, font: "Courier New" }); // Set score to 0 LK.setScore(0); scoreTxt.setText(LK.getScore()); scoreTxt.anchor.set(0.5, 0); scoreTxt.y += 9; LK.gui.top.addChild(scoreTxt); // Add LevelCounter text 200 pixels under Score var levelCounterTxt = new Text2('Text here', { size: 65, fill: 0xb6bcd6, font: "Courier New" }); levelCounterTxt.anchor.set(0.5, 0); levelCounterTxt.y = scoreTxt.y + 170; LK.gui.top.addChild(levelCounterTxt); for (var i = 0; i < 6; i++) { var rectangle = game.addChild(new WhiteRectangle()); rectangle.x = 2048 - rectangle.width / 2 + 20 - 15; // Move to the right side of the screen and 20 pixels more to the right, then move 15 pixels to the left rectangle.y = i * (rectangle.height + 10) + 945; // Move 945 pixels lower }
===================================================================
--- original.js
+++ change.js
@@ -10,9 +10,9 @@
anchorY: 0.5,
scaleX: 2.112 * 1.08 * 1.05 * 1.08 * 1.05,
scaleY: 2.112 * 1.08 * 1.05 * 1.08 * 1.05,
alpha: 1,
- tint: self.LightType === 'on3' ? 0xEDF8FF : self.LightType === 'on2' ? 0x888FA2 : self.LightType === 'on1' ? 0x494F69 : 0x121636
+ tint: self.LightType === 'on3' ? 0xEDF8FF : self.LightType === 'on2' ? 0x888FA2 : self.LightType === 'on1' ? 0x6B7187 : 0x121636
});
});
var WhiteRectangle = Container.expand(function () {
var self = Container.call(this);
square with Neon dark blue borders, simple, futuristic, 2d. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Sci-fi Vault dark Concrete wall texture 2d. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Scifi Square with thin, rounded corners. Dark grey. 2d. Single Game Texture. Little blue outline
Smooth white circle, 2d, simple. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Rounded white square. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.