Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'downRow is undefined' in or related to this line: 'var downBlock = downRow.blocks[i];' Line Number: 206
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'blockClasses is undefined' in or related to this line: 'var blockClass = blockClasses[i];' Line Number: 183
User prompt
Please fix the bug: 'blockClasses is undefined' in or related to this line: 'var blockClass = blockClasses[i];' Line Number: 183
Code edit (1 edits merged)
Please save this source code
User prompt
in the randomizeBlockClass return a random element in the classes array
Code edit (7 edits merged)
Please save this source code
User prompt
remove ROW_MIDPOINT and ROW_SPAN_BASE
User prompt
Please fix the bug: 'ROW_SPAN_BASE is not defined' in or related to this line: 'var ROW_MIDPOINT = Math.floor(ROW_SPAN_BASE / 2);' Line Number: 428
Code edit (11 edits merged)
Please save this source code
User prompt
create an instance of the BlockManager class before creating the lava
User prompt
create a new empty BlockManager class that inherits from the Container class
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'layerAlpha is not defined' in or related to this line: 'self.attachAsset('shapeBox', {' Line Number: 128
Code edit (1 edits merged)
Please save this source code
User prompt
each lavaslice should create a glow instance with a scaley of -1, height of 20, range of 100, and width of LAVA_SLICE_WIDTH
User prompt
each subsequent glowlayer should have it's height increased by config.range (default of 0) divide by layers
User prompt
Create a new Glow class that inherits from the ConfigContainer that creates a number of shapeBox assets with anchor 0.5,1.0 and width, height and tint derived config.width, config.height, and config.tint. The number of assets is determined by config.layers (minimum of 2, default of 10), the alpha of each asset is determined from config.alpha (default of 1) divided by the number of layers
Code edit (6 edits merged)
Please save this source code
User prompt
tint the lava slice asset orange
Code edit (1 edits merged)
Please save this source code
User prompt
add an update method to the LavaSlice class where the y position is set to the sin of the ticks
User prompt
add a lavaslice update method which sets its y position based on a sin of the game time
===================================================================
--- original.js
+++ change.js
@@ -13,23 +13,14 @@
blockRows.push(self.addChild(new BlockRow(settings)));
};
self.popRow = function () {
blockRows.pop();
- var _iterator = _createForOfIteratorHelper(blockRows[0].blocks),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var block = _step.value;
- if (block) {
- block.downBlock = undefined;
- }
+ blockRows[0].blocks.forEach(function (block) {
+ if (block) {
+ block.downBlock = undefined;
}
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- seld.addRow({});
+ });
+ self.addRow({});
};
return self;
});
var ConfigContainer = Container.expand(function (config) {
@@ -84,9 +75,16 @@
anchorY: 0,
width: LAVA_SLICE_WIDTH,
tint: 0xFFA500
});
- var glow = self.addChild(new Glow({
+ self.attachAsset('shapeBox', {
+ width: LAVA_SLICE_WIDTH,
+ height: 5,
+ anchorX: 0.5,
+ anchorY: 0,
+ tint: 0xFF4D00
+ });
+ self.addChild(new Glow({
asset: 'shapeBox',
anchorX: 0.5,
anchorY: 0.75,
height: 20,
@@ -130,8 +128,17 @@
return self;
});
var BlockRow = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
+ var blockClasses = generateBlockClasses(config.index);
+ self.blocks = [];
+ for (var i = 0; i < ROW_SPAN; i++) {
+ var blockClass = blockClasses[i];
+ self.blocks[i] = self.addChild(new blockClass({
+ x: (i - ROW_SPAN / 2) * BLOCK_SIZE * BLOCK_SCALE,
+ scale: BLOCK_SCALE
+ }));
+ }
return self;
});
var Block = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -367,74 +374,8 @@
/****
* Game Code
****/
-function _createForOfIteratorHelper(r, e) {
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
- if (!t) {
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
- t && (r = t);
- var _n = 0,
- F = function F() {};
- return {
- s: F,
- n: function n() {
- return _n >= r.length ? {
- done: !0
- } : {
- done: !1,
- value: r[_n++]
- };
- },
- e: function e(r) {
- throw r;
- },
- f: F
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- var o,
- a = !0,
- u = !1;
- return {
- s: function s() {
- t = t.call(r);
- },
- n: function n() {
- var r = t.next();
- return a = r.done, r;
- },
- e: function e(r) {
- u = !0, o = r;
- },
- f: function f() {
- try {
- a || null == t["return"] || t["return"]();
- } finally {
- if (u) {
- throw o;
- }
- }
- }
- };
-}
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) {
- return _arrayLikeToArray(r, a);
- }
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
- }
-}
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) {
- n[e] = r[e];
- }
- return n;
-}
var LAVA_LINE = game.height - 200;
var LAVA_SLICE_COUNT = 18;
var LAVA_SLICE_WIDTH = 128;
var LAVA_BOB_HEIGHT = 10;
@@ -444,17 +385,25 @@
var BLOCK_SIZE = 100;
var BLOCK_HALFSIZE = BLOCK_SIZE * 0.5;
var BLOCK_ROTATE_SPEED = 100;
var LIGHT_GROW_SPEED = 500;
-var blockTypes = [BlockX, BlockT, BlockLine, BlockL, BlockBlank];
-blockTypes.forEach(function (BlockType, index) {
- var block = game.addChild(new BlockType({
- x: game.width / 2,
- y: 300 + index * 300,
- scale: BLOCK_SCALE
- }));
-});
+var ROW_SPAN = 7;
+var ROW_SPAN_BASE = 7; // Define ROW_SPAN_BASE
+var ROW_MIDPOINT = Math.floor(ROW_SPAN_BASE / 2);
var blockManager = game.addChild(new BlockManager());
var lava = game.addChild(new Lava({
x: game.width / 2,
y: LAVA_LINE
-}));
\ No newline at end of file
+}));
+function generateBlockClasses(index) {
+ switch (index) {
+ case 0:
+ return [BlockBlank, BlockBlank, BlockBlank, BlockX, BlockBlank, BlockBlank, BlockBlank];
+ case 1:
+ return [BlockBlank, randomizeBlockClass(index), randomizeBlockClass(index), BlockX, randomizeBlockClass(index), randomizeBlockClass(index), BlockBlank];
+ default:
+ return [randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index), randomizeBlockClass(index)];
+ }
+}
+function randomizeBlockClass(index) {
+ var classes = [BlockBlank, BlockT, BlockX, BlockLine, BlockL];
+}
\ No newline at end of file
background
Music
light
Sound effect
rotate
Sound effect
error
Sound effect
crack
Sound effect
break
Sound effect
flow
Sound effect
bubble1
Sound effect
bubble2
Sound effect
bubble3
Sound effect
bubble4
Sound effect
bubble5
Sound effect
gong
Sound effect