Code edit (5 edits merged)
Please save this source code
User prompt
decrease the rotation speed of box when destroyed on slice
Code edit (6 edits merged)
Please save this source code
User prompt
make kitty jump in the same place and not move downwards.
Code edit (1 edits merged)
Please save this source code
User prompt
add a new condition in kitty class without changing the current ones. if iskittyvisible is true the kitty should have jump movement.
User prompt
ghosly movement shoudl move upwards for 1.5 seconds and then move downwards
Code edit (3 edits merged)
Please save this source code
User prompt
add jump movemet to kitty. this movemnt should only start after box is destroyed.
Code edit (1 edits merged)
Please save this source code
User prompt
spawn shadow on game start
User prompt
Fix Bug: 'Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.DisplayObjectContainer' --- property 'parent' closes the circle' in this line: 'self.createAsset(self.assetId, 'Shadow Graphics', .5, .5);' Line Number: 4
User prompt
Fix Bug: 'Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.DisplayObjectContainer' --- property 'parent' closes the circle' in this line: 'var shadowGraphics = this.createAsset(this.assetId, 'Shadow Graphics', .5, .5);' Line Number: 195
User prompt
Fix Bug: 'Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.DisplayObjectContainer' --- property 'parent' closes the circle' in this line: 'var shadowGraphics = self.createAsset(assetId, 'Shadow Graphics', .5, .5);' Line Number: 3
Code edit (2 edits merged)
Please save this source code
User prompt
create a new indepent class for the shadow asset
User prompt
remove shadows class from kitty. should be an indepent class
User prompt
when ghostly movement happens, only nokitty should move. shadow should remain on initial position
User prompt
gostly movemet shoudl be sutil and always upwards
Code edit (1 edits merged)
Please save this source code
User prompt
add ghosty movement to nokitty. it should only be in a 100 pixel radius. nokitty should only move after box is destroyed.
User prompt
shadows should be displaye both for kitty and nokitty
User prompt
add shadow to kitty
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: self.setBoxDestroyed is not a function' in this line: 'self.setBoxDestroyed(true);' Line Number: 83
var BoxPiece = Container.expand(function (assetId, direction) {
var self = Container.call(this);
LK.on('tick', function () {
self.x += self.direction.x * 10;
self.y += self.direction.y * 10;
pieceGraphics.rotation += 0.05;
});
var pieceGraphics = self.createAsset(assetId, 'Box Piece Graphics', 0.5, 0.5);
self.direction = direction;
});
var MessageDisplay = Container.expand(function (assetId, description) {
var self = Container.call(this);
self.shouldMoveUp = false;
var messageAsset = self.createAsset(assetId, description, 0.5, 0.5);
self.show = function () {
self.visible = true;
};
self.hide = function () {
self.visible = false;
};
self.setMessage = function (newAssetId, newDescription) {
self.removeChild(messageAsset);
messageAsset = self.createAsset(newAssetId, newDescription, 0.5, 0.5);
};
LK.on('tick', function () {
if (self.shouldMoveUp) {
self.y -= 2;
if (self.y < 300) {
self.shouldMoveUp = false;
}
}
});
self.on('down', function (obj) {
if (obj && obj.event && self.parent) {
self.startPos = obj.event.getLocalPosition(self.parent);
}
});
self.on('up', function (obj) {
if (obj && obj.event && self.parent) {
var endPos = obj.event.getLocalPosition(self.parent);
}
if (this.startPos && this.startPos.y > endPos.y && Math.abs(this.startPos.y - endPos.y) > 100) {
self.shouldMoveUp = true;
}
});
});
var Box = Container.expand(function (game) {
var self = Container.call(this);
self.game = game;
self.on('down', function (obj) {
if (obj && obj.event) {
if (obj && obj.event && self.parent) {
if (self.parent) {
this.startPos = obj.event.getLocalPosition(self.parent);
}
}
}
var currentTime = Date.now();
if (currentTime - lastClickTime < 300) {
clickCount++;
if (clickCount === 2) {
var directions = [{
x: -1,
y: -1
}, {
x: 1,
y: -1
}, {
x: -1,
y: 1
}, {
x: 1,
y: 1
}];
for (var i = 0; i < 4; i++) {
var piece = new BoxPiece('boxPiece' + (i + 1), directions[i]);
piece.x = self.x;
piece.y = self.y;
self.parent.addChild(piece);
}
self.destroy();
console.log('Box explode on double click');
self.game.setBoxDestroyed(true);
LK.setTimeout(function () {
LK.showGameOver();
}, 4000);
}
} else {
clickCount = 1;
}
lastClickTime = currentTime;
});
self.on('up', function (obj) {
if (obj && obj.event && self.parent) {
var endPos = obj.event.getLocalPosition(self.parent);
}
var swipeAcrossBox = this.startPos.x < self.x && endPos.x > self.x || this.startPos.x > self.x && endPos.x < self.x;
if (swipeAcrossBox) {
var topPiece = new BoxPiece('boxTop', {
x: 0,
y: -1
});
var bottomPiece = new BoxPiece('boxBottom', {
x: 0,
y: 1
});
topPiece.x = self.x;
topPiece.y = self.y - self.height / 4;
bottomPiece.x = self.x;
bottomPiece.y = self.y + self.height / 4;
self.parent.addChild(topPiece);
self.parent.addChild(bottomPiece);
self.destroy();
console.log('Box explode on slice');
self.game.setBoxDestroyed(true);
LK.setTimeout(function () {
LK.showGameOver();
}, 4000);
} else {
self.velocity.x = endPos.x - this.startPos.x;
self.velocity.y = endPos.y - this.startPos.y;
self.direction.x = self.velocity.x > 0 ? 1 : -1;
self.direction.y = self.velocity.y > 0 ? 1 : -1;
self.velocity.x = Math.abs(self.velocity.x) > 5 ? 25 * self.direction.x : 0;
self.velocity.y = Math.abs(self.velocity.y) > 5 ? 25 * self.direction.y : 0;
self.rotationSpeed = 0.1 * self.direction.x;
}
});
var boxGraphics = self.createAsset('box', 'Box Graphics', .5, .5);
var clickCount = 0;
var lastClickTime = 0;
this.startPos = {
x: 0,
y: 0
};
self.on('down', function (obj) {
if (obj && obj.event && self.parent) {
this.startPos = obj.event.getLocalPosition(self.parent);
}
});
self.velocity = {
x: 0,
y: 0
};
self.direction = {
x: 0,
y: 0
};
LK.on('tick', function () {
if (!self.game.boxDestroyed) {
self.x += self.velocity.x * (125 / 60);
self.y += self.velocity.y * (125 / 60);
if (self.velocity.x !== 0 || self.velocity.y !== 0) {
self.rotation += self.rotationSpeed;
}
if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) {
self.destroy();
console.log('Box explode on swipe');
self.game.setBoxDestroyed(true);
LK.setTimeout(function () {
LK.showGameOver();
}, 4000);
}
}
});
});
var Kitty = Container.expand(function (game) {
var self = Container.call(this);
self.game = game;
var isKittyVisible = Math.random() < 0.5;
var kittyGraphics = self.createAsset(isKittyVisible ? 'kitty' : 'nokitty', isKittyVisible ? 'Kitty Graphics' : 'No Kitty Graphics', .5, .5);
if (!isKittyVisible) {
var shadowGraphics = self.createAsset('shadow', 'Shadow Graphics', .5, 1);
self.addChildAt(shadowGraphics, 0);
shadowGraphics.y = kittyGraphics.height / 2 + 20;
self.game.isKittyVisible = false;
console.log('Kitty is Invisible');
} else {
self.game.isKittyVisible = true;
}
});
var Game = Container.expand(function () {
var self = Container.call(this);
LK.stageContainer.setBackgroundColor(0x000000);
this.isKittyVisible = false;
this.boxDestroyed = false;
var redbutton = self.createAsset('redbutton', 'Red Button Graphics', 0.5, 0.5);
redbutton.on('down', function () {
var growInterval = LK.setInterval(function () {
self.box.scale.x += 0.05;
self.box.scale.y += 0.05;
if (self.box.width >= 2048 || self.box.height >= 2732) {
LK.clearInterval(growInterval);
self.box.destroy();
console.log('Red button touched, box destroyed');
self.setBoxDestroyed(true);
self.game.setBoxDestroyed(true);
LK.setTimeout(function () {
LK.showGameOver();
}, 4000);
}
}, 16.6667);
});
var messageDisplay = self.addChild(new MessageDisplay('yesorno', 'Yes or No Display'));
var noMessageDisplay = self.addChild(new MessageDisplay('no', 'No Display'));
var yesMessageDisplay = self.addChild(new MessageDisplay('yes', 'Yes Display'));
self.kitty = self.addChild(new Kitty(self));
self.box = self.addChild(new Box(self));
noMessageDisplay.x = 2048 / 2;
noMessageDisplay.y = 2732 / 2 + 700;
yesMessageDisplay.x = 2048 / 2;
yesMessageDisplay.y = 2732 / 2 + 700;
yesMessageDisplay.visible = false;
noMessageDisplay.visible = false;
self.kitty.x = 2048 / 2;
self.kitty.y = 2732 / 2;
self.box.x = 2048 / 2;
self.box.y = 2732 / 2;
messageDisplay.x = self.box.x;
messageDisplay.y = self.box.y - 800;
redbutton.x = self.box.x;
redbutton.y = self.box.y - 800;
messageDisplay.show();
this.setisKittyVisible = function (value) {
this.isKittyVisible = value;
console.log('Inside method', self.isKittyVisible);
};
this.setBoxDestroyed = function (value) {
this.boxDestroyed = value;
if (this.boxDestroyed) {
console.log('Inside loop', self.isKittyVisible);
if (self.isKittyVisible) {
console.log('Kitty is visible. Displaying yes message.');
yesMessageDisplay.show();
} else {
console.log('Kitty is Not Visible. Displaying No message.');
noMessageDisplay.show();
}
}
};
});
8-bit. cartoon. red button. do not touch! Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. black tub stopper with chain. in game asset.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. axe. in game asset. no shadow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Break in case of emergency square. Ax drawing inside. simple. 8-bit. cartoon. blackand white.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Delete