Code edit (1 edits merged)
Please save this source code
User prompt
In the BlockL class, attach both blockL1 and blockL2 assets (do not randomize)
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'blockTypes is undefined' in or related to this line: 'blockTypes.forEach(function (BlockType, index) {' Line Number: 101
User prompt
display all Block child types uniformly spaced down the center of the screen
User prompt
In the BlockLine class, attach both blockLine1 and blockLine2 assets (do not randomize)
User prompt
In the BlockLine class, attach two assets; blockLine1 and blockLine2
User prompt
set the BlockBlank's randomAssest width and height to BLOCK_SIZE
User prompt
create a global constant BLOCK_SIZE = 100
User prompt
for the blockblank class, randomly attach either blockBlank1-3 asset with an anchor of 0.5,0.5
User prompt
Create empty BlockX class that inherits from the Block class
User prompt
Create empty BlockT class that inherits from the Block class
User prompt
Create empty BlockLine class that inherits from the Block class
User prompt
stop deleting the damn other classes
User prompt
Create empty BlockBlank class that inherits from the Block class
User prompt
Create empty BlockL class that inherits from the Block class
Code edit (1 edits merged)
Please save this source code
User prompt
Create an empty block class that inherits from the configContaienr
Code edit (1 edits merged)
Please save this source code
User prompt
Remove all existing functionality and assets
Initial prompt
Lava Lamp
/**** * Classes ****/ var ConfigContainer = Container.expand(function (config) { var self = Container.call(this); config = config || {}; var destroyCalled = false; self.tags = {}; self.x = config.x || 0; self.y = config.y || 0; self.rotation = config.rotation || 0; self.alpha = config.alpha !== undefined ? config.alpha : 1.0; if (config.scale !== undefined || config.scaleX !== undefined || config.scaleY !== undefined) { var scaleX = config.scaleX !== undefined ? config.scaleX : config.scale !== undefined ? config.scale : 1; var scaleY = config.scaleY !== undefined ? config.scaleY : config.scale !== undefined ? config.scale : 1; self.scale.set(scaleX, scaleY); } self.callDestroy = function () { if (!destroyCalled) { destroyCalled = true; self.onDestroy(); self.destroy(); } }; self.onDestroy = function () {}; return self; }); var Block = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); return self; }); var BlockX = Block.expand(function (config) { var self = Block.call(this, config); return self; }); var BlockT = Block.expand(function (config) { var self = Block.call(this, config); return self; }); var BlockLine = Block.expand(function (config) { var self = Block.call(this, config); self.attachAsset('blockLine1', { x: -BLOCK_HALFSIZE, anchorX: 0, anchorY: 0.5, height: BLOCK_SIZE }); self.attachAsset('blockLine2', { x: BLOCK_HALFSIZE, anchorX: 1, anchorY: 0.5, height: BLOCK_SIZE }); return self; }); var BlockL = Block.expand(function (config) { var self = Block.call(this, config); self.attachAsset('blockL1', { anchorX: 0.5, anchorY: 0.5, height: BLOCK_SIZE }); self.attachAsset('blockL2', { x: 0, y: BLOCK_HALFSIZE, anchorX: 0, anchorY: 1 }); return self; }); var BlockBlank = Block.expand(function (config) { var self = Block.call(this, config); var blockBlankAssets = ['blockBlank1', 'blockBlank2', 'blockBlank3']; var randomAsset = blockBlankAssets[Math.floor(Math.random() * blockBlankAssets.length)]; self.attachAsset(randomAsset, { anchorX: 0.5, anchorY: 0.5, width: BLOCK_SIZE, height: BLOCK_SIZE }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var BLOCK_SIZE = 100; var BLOCK_HALFSIZE = BLOCK_SIZE * 0.5; var blockTypes = [BlockX, BlockT, BlockLine, BlockL, BlockBlank]; blockTypes.forEach(function (BlockType, index) { var block = game.addChild(new BlockType()); block.x = game.width / 2; block.y = index * BLOCK_SIZE + BLOCK_SIZE / 2; });
===================================================================
--- original.js
+++ change.js
@@ -55,18 +55,17 @@
});
var BlockL = Block.expand(function (config) {
var self = Block.call(this, config);
self.attachAsset('blockL1', {
- x: -BLOCK_HALFSIZE,
- anchorX: 0,
+ anchorX: 0.5,
anchorY: 0.5,
height: BLOCK_SIZE
});
self.attachAsset('blockL2', {
- x: BLOCK_HALFSIZE,
- anchorX: 1,
- anchorY: 0.5,
- height: BLOCK_SIZE
+ x: 0,
+ y: BLOCK_HALFSIZE,
+ anchorX: 0,
+ anchorY: 1
});
return self;
});
var BlockBlank = Block.expand(function (config) {