Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
When creating cells in board make sure the cells are put into the right position in this.grid
User prompt
Fix Bug: 'ReferenceError: Can't find variable: startY' in this line: 'var cell = board.grid && board.grid[startY + i] && board.grid[startY + i][startX + j];' Line Number: 59
User prompt
rather than referring to self.parent.grid refer to board.grid
User prompt
In block remove the shape argument and replace it with a board agument
User prompt
when creating a block pass along the board instance to the creator
User prompt
Make sure blocks is initialized as a 10x10 grid
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.parent.grid[startY + i]')' in this line: 'var cell = self.parent.grid[startY + i] && self.parent.grid[startY + i][startX + j];' Line Number: 75
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.parent.grid[startY + i]')' in this line: 'var cell = self.parent.grid[startY + i] && self.parent.grid[startY + i][startX + j];' Line Number: 75
User prompt
When dragging a block above the board, calculate which block blocks overlap cells in the board. And set those sell colors to red by tinting them red
User prompt
When dragging a block above the board, calculate which block blocks overlap cells in the board. And set those sell colors to red by tinting them red
User prompt
Board should be created before blocks are created
User prompt
Add logic that allows me to drag and drop the blocks crated in Game
User prompt
set alpha on the block background asset to .5
User prompt
In Game, create a method that creates a new block and use that instead when creating blocks
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'block.dragData.getLocalPosition')' in this line: 'block.dragOffsetX = block.dragData.getLocalPosition(block.parent).x - block.x;' Line Number: 76
User prompt
Allow me to drag and drop the blocks created in GAme
User prompt
set blockSize to 160
User prompt
set block size to 170
User prompt
you define var blockSize = 150; twice in block class, remove the second instance
User prompt
Remove the secound definition of blockSize in the block class
User prompt
Only define blockSize once in Block
User prompt
Used a size variable everywhere you use 150 in Block class
===================================================================
--- original.js
+++ change.js
@@ -7,9 +7,9 @@
QUAD: [[1, 1, 1, 1]],
LSHAPE: [[1, 0, 0], [1, 0, 0], [1, 1, 1]]
};
var shapes = Object.values(ShapeTypes);
- self.shape = shapes[Math.floor(Math.random() * shapes.length)];
+ self.shape = shapes[Math.floor(0)];
self.rotateShapeRandomly = function () {
var rotations = Math.floor(Math.random() * 4);
for (var r = 0; r < rotations; r++) {
self.shape = self.shape[0].map((val, index) => self.shape.map(row => row[index]).reverse());
@@ -52,8 +52,9 @@
});
stage.on('up', function (obj) {
if (self.dragging) {
self.dragging = false;
+ return;
for (var i = 0; i < self.shape.length; i++) {
for (var j = 0; j < self.shape[i].length; j++) {
if (self.shape[i][j] === 1) {
var cell = board.grid && board.grid[startY + i] && board.grid[startY + i][startX + j];
@@ -65,12 +66,17 @@
}
}
});
self.calculateOverlap = function () {
- var boardPos = self.parent.toLocal(self.position, self);
- var startX = Math.floor((boardPos.x + self.parent.width / 2) / 160);
- var startY = Math.floor((boardPos.y + self.parent.height / 2) / 160);
- console.log(startX, startY);
+ var boardPos = {
+ x: board.x + self.x,
+ y: board.y - self.x
+ };
+ boardPos.x += 160 * 4;
+ boardPos.y += 160 * 4;
+ console.log(boardPos);
+ var startX = Math.floor(boardPos.x / 160);
+ var startY = Math.floor(boardPos.y / 160);
for (var i = 0; i < self.shape.length; i++) {
for (var j = 0; j < self.shape[i].length; j++) {
if (self.shape[i][j] === 1) {
var cell = board.grid && board.grid[startY + i] && board.grid[startY + i][startX + j];
White square with round corners, flat shaded, hyper casual game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White square with tight round corners, flat shaded, hyper casual game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Background for relaxing puzzle game. Pastel colors, flat shaded, vector art. Flowers. Blocks. Relaxing. Clouds Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White particle cloud. Cartoon. Bright outline. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.