User prompt
Remove the old grey let only the new
User prompt
add the assets grey1 2 3 4 5 6 7 8 9 to the game to cover the testentity objects.
User prompt
Add grey1 2 3 4 5 6 7 8 9 assets as covers to the game to replace the greyentities covers.
User prompt
Please fix the bug: 'TypeError: entityGraphics.setText is not a function' in or related to this line: 'entityGraphics.setText(self.number); // Display the unique number on each greyEntity object' Line Number: 19
User prompt
Make the greyentity separated by number
User prompt
repeat the cost of 100 if i click any greyentity object.
User prompt
Add click event to the duplicated greyentitiy objects to cost 100 and get removed.
User prompt
make it repeated not just in the first clicked one then stop costing!
User prompt
sync the images of testentity to move in same time by dragg of any testentity image.
User prompt
not continuously like many clicks for one no! its 1 click and one cost of $100 each greyentity cover is clicked
User prompt
don't remove $100 only the first time make it continuously!
User prompt
each click on a cover object make it cost $100 from the original score.
User prompt
Please fix the bug: 'ReferenceError: greyEntity is not defined' in or related to this line: 'greyEntity.update();' Line Number: 108
User prompt
cover all 9 greyentity objects
User prompt
Please fix the bug: 'ReferenceError: testEntity is not defined' in or related to this line: 'testEntity.update();' Line Number: 100
User prompt
Remove duplications of testentity
User prompt
set the 9 testentity objects can be moved by dregging any testentity
User prompt
add dreg to testentity
User prompt
reorder the covers images to be after the testentities images.
User prompt
Add cover for other testentity objects
User prompt
Please fix the bug: 'ReferenceError: greyEntity is not defined' in or related to this line: 'greyEntity.update();' Line Number: 105
User prompt
Remove all covers and there duplication
User prompt
each time i click a cover remove $100
User prompt
Reorder the greyentities to be after the testsentities
User prompt
Please fix the bug: 'ReferenceError: greyEntity is not defined' in or related to this line: 'greyEntity.update();' Line Number: 130
/**** * Classes ****/ var GreyEntity = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('greyEntity', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for GreyEntity }; self.down = function (x, y, obj) { self.destroy(); if (scoreTxt && scoreTxt.text) { var currentScore = parseInt(scoreTxt.text.replace('$', '')); scoreTxt.setText('$' + (currentScore - 100)); } }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> //<Write entity 'classes' with empty functions for important behavior here> var TestEntity = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('testEntity', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for TestEntity }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x888888 //Init game with black background }); /**** * Game Code ****/ //<Write game logic code here, including initializing arrays and variables> var testEntity = game.addChild(new TestEntity()); testEntity.x = 2048 / 2; testEntity.y = 2732 / 2; var testEntityTop = game.addChild(new TestEntity()); testEntityTop.x = 2048 / 2; testEntityTop.y = 2732 / 2 - testEntity.height; var greyEntity1 = game.addChild(new GreyEntity()); greyEntity1.x = testEntityTop.x; greyEntity1.y = testEntityTop.y; var testEntityBottom = game.addChild(new TestEntity()); testEntityBottom.x = 2048 / 2; testEntityBottom.y = 2732 / 2 + testEntity.height; var greyEntity2 = game.addChild(new GreyEntity()); greyEntity2.x = testEntityBottom.x; greyEntity2.y = testEntityBottom.y; var testEntityLeft = game.addChild(new TestEntity()); testEntityLeft.x = 2048 / 2 - testEntity.width; testEntityLeft.y = 2732 / 2; var greyEntity3 = game.addChild(new GreyEntity()); greyEntity3.x = testEntityLeft.x; greyEntity3.y = testEntityLeft.y; var testEntityTopRight = game.addChild(new TestEntity()); testEntityTopRight.x = 2048 / 2 + testEntity.width; testEntityTopRight.y = 2732 / 2 - testEntity.height; var greyEntity4 = game.addChild(new GreyEntity()); greyEntity4.x = testEntityTopRight.x; greyEntity4.y = testEntityTopRight.y; var testEntityTopLeft = game.addChild(new TestEntity()); testEntityTopLeft.x = 2048 / 2 - testEntity.width; testEntityTopLeft.y = 2732 / 2 - testEntity.height; var greyEntity5 = game.addChild(new GreyEntity()); greyEntity5.x = testEntityTopLeft.x; greyEntity5.y = testEntityTopLeft.y; var testEntityBottomRight = game.addChild(new TestEntity()); testEntityBottomRight.x = 2048 / 2 + testEntity.width; testEntityBottomRight.y = 2732 / 2 + testEntity.height; var greyEntity6 = game.addChild(new GreyEntity()); greyEntity6.x = testEntityBottomRight.x; greyEntity6.y = testEntityBottomRight.y; var testEntityBottomLeft = game.addChild(new TestEntity()); testEntityBottomLeft.x = 2048 / 2 - testEntity.width; testEntityBottomLeft.y = 2732 / 2 + testEntity.height; var greyEntity7 = game.addChild(new GreyEntity()); greyEntity7.x = testEntityBottomLeft.x; greyEntity7.y = testEntityBottomLeft.y; var testEntityRight = game.addChild(new TestEntity()); testEntityRight.x = 2048 / 2 + testEntity.width; testEntityRight.y = 2732 / 2; var greyEntity8 = game.addChild(new GreyEntity()); greyEntity8.x = testEntityRight.x; greyEntity8.y = testEntityRight.y; var greyEntity9 = game.addChild(new GreyEntity()); greyEntity9.x = testEntity.x; greyEntity9.y = testEntity.y; var testEntityBottom = game.addChild(new TestEntity()); testEntityBottom.x = 2048 / 2; testEntityBottom.y = 2732 / 2 + testEntity.height; var testEntityLeft = game.addChild(new TestEntity()); testEntityLeft.x = 2048 / 2 - testEntity.width; testEntityLeft.y = 2732 / 2; var testEntityTopRight = game.addChild(new TestEntity()); testEntityTopRight.x = 2048 / 2 + testEntity.width; testEntityTopRight.y = 2732 / 2 - testEntity.height; var testEntityTopLeft = game.addChild(new TestEntity()); testEntityTopLeft.x = 2048 / 2 - testEntity.width; testEntityTopLeft.y = 2732 / 2 - testEntity.height; var testEntityBottomRight = game.addChild(new TestEntity()); testEntityBottomRight.x = 2048 / 2 + testEntity.width; testEntityBottomRight.y = 2732 / 2 + testEntity.height; var testEntityBottomLeft = game.addChild(new TestEntity()); testEntityBottomLeft.x = 2048 / 2 - testEntity.width; testEntityBottomLeft.y = 2732 / 2 + testEntity.height; var testEntityRight = game.addChild(new TestEntity()); testEntityRight.x = 2048 / 2 + testEntity.width; testEntityRight.y = 2732 / 2; var greyEntity = game.addChild(new GreyEntity()); greyEntity.x = 2048 / 2; greyEntity.y = 2732 / 2; game.update = function () { // Game update logic testEntity.update(); greyEntity.update(); }; game.down = function (x, y, obj) { // Handle touch or mouse down event console.log("Game was touched at", x, y); }; game.up = function (x, y, obj) { // Handle touch or mouse up event console.log("Touch released at", x, y); }; // Create score text var scoreTxt = new Text2('$1000', { size: 120, fill: 0x0ce729 }); scoreTxt.anchor.set(0.5, 0); // Sets anchor to the center of the top edge of the text. LK.gui.top.addChild(scoreTxt); // Add the score text to the GUI overlay at the top-center of the screen. // Initialize scoreTxt.text to avoid undefined error scoreTxt.text = '$1000'; game.move = function (x, y, obj) { // Handle touch or mouse move event console.log("Moving at", x, y); };
/****
* Classes
****/
var GreyEntity = Container.expand(function () {
var self = Container.call(this);
var entityGraphics = self.attachAsset('greyEntity', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for GreyEntity
};
self.down = function (x, y, obj) {
self.destroy();
if (scoreTxt && scoreTxt.text) {
var currentScore = parseInt(scoreTxt.text.replace('$', ''));
scoreTxt.setText('$' + (currentScore - 100));
}
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
//<Write entity 'classes' with empty functions for important behavior here>
var TestEntity = Container.expand(function () {
var self = Container.call(this);
var entityGraphics = self.attachAsset('testEntity', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for TestEntity
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x888888 //Init game with black background
});
/****
* Game Code
****/
//<Write game logic code here, including initializing arrays and variables>
var testEntity = game.addChild(new TestEntity());
testEntity.x = 2048 / 2;
testEntity.y = 2732 / 2;
var testEntityTop = game.addChild(new TestEntity());
testEntityTop.x = 2048 / 2;
testEntityTop.y = 2732 / 2 - testEntity.height;
var greyEntity1 = game.addChild(new GreyEntity());
greyEntity1.x = testEntityTop.x;
greyEntity1.y = testEntityTop.y;
var testEntityBottom = game.addChild(new TestEntity());
testEntityBottom.x = 2048 / 2;
testEntityBottom.y = 2732 / 2 + testEntity.height;
var greyEntity2 = game.addChild(new GreyEntity());
greyEntity2.x = testEntityBottom.x;
greyEntity2.y = testEntityBottom.y;
var testEntityLeft = game.addChild(new TestEntity());
testEntityLeft.x = 2048 / 2 - testEntity.width;
testEntityLeft.y = 2732 / 2;
var greyEntity3 = game.addChild(new GreyEntity());
greyEntity3.x = testEntityLeft.x;
greyEntity3.y = testEntityLeft.y;
var testEntityTopRight = game.addChild(new TestEntity());
testEntityTopRight.x = 2048 / 2 + testEntity.width;
testEntityTopRight.y = 2732 / 2 - testEntity.height;
var greyEntity4 = game.addChild(new GreyEntity());
greyEntity4.x = testEntityTopRight.x;
greyEntity4.y = testEntityTopRight.y;
var testEntityTopLeft = game.addChild(new TestEntity());
testEntityTopLeft.x = 2048 / 2 - testEntity.width;
testEntityTopLeft.y = 2732 / 2 - testEntity.height;
var greyEntity5 = game.addChild(new GreyEntity());
greyEntity5.x = testEntityTopLeft.x;
greyEntity5.y = testEntityTopLeft.y;
var testEntityBottomRight = game.addChild(new TestEntity());
testEntityBottomRight.x = 2048 / 2 + testEntity.width;
testEntityBottomRight.y = 2732 / 2 + testEntity.height;
var greyEntity6 = game.addChild(new GreyEntity());
greyEntity6.x = testEntityBottomRight.x;
greyEntity6.y = testEntityBottomRight.y;
var testEntityBottomLeft = game.addChild(new TestEntity());
testEntityBottomLeft.x = 2048 / 2 - testEntity.width;
testEntityBottomLeft.y = 2732 / 2 + testEntity.height;
var greyEntity7 = game.addChild(new GreyEntity());
greyEntity7.x = testEntityBottomLeft.x;
greyEntity7.y = testEntityBottomLeft.y;
var testEntityRight = game.addChild(new TestEntity());
testEntityRight.x = 2048 / 2 + testEntity.width;
testEntityRight.y = 2732 / 2;
var greyEntity8 = game.addChild(new GreyEntity());
greyEntity8.x = testEntityRight.x;
greyEntity8.y = testEntityRight.y;
var greyEntity9 = game.addChild(new GreyEntity());
greyEntity9.x = testEntity.x;
greyEntity9.y = testEntity.y;
var testEntityBottom = game.addChild(new TestEntity());
testEntityBottom.x = 2048 / 2;
testEntityBottom.y = 2732 / 2 + testEntity.height;
var testEntityLeft = game.addChild(new TestEntity());
testEntityLeft.x = 2048 / 2 - testEntity.width;
testEntityLeft.y = 2732 / 2;
var testEntityTopRight = game.addChild(new TestEntity());
testEntityTopRight.x = 2048 / 2 + testEntity.width;
testEntityTopRight.y = 2732 / 2 - testEntity.height;
var testEntityTopLeft = game.addChild(new TestEntity());
testEntityTopLeft.x = 2048 / 2 - testEntity.width;
testEntityTopLeft.y = 2732 / 2 - testEntity.height;
var testEntityBottomRight = game.addChild(new TestEntity());
testEntityBottomRight.x = 2048 / 2 + testEntity.width;
testEntityBottomRight.y = 2732 / 2 + testEntity.height;
var testEntityBottomLeft = game.addChild(new TestEntity());
testEntityBottomLeft.x = 2048 / 2 - testEntity.width;
testEntityBottomLeft.y = 2732 / 2 + testEntity.height;
var testEntityRight = game.addChild(new TestEntity());
testEntityRight.x = 2048 / 2 + testEntity.width;
testEntityRight.y = 2732 / 2;
var greyEntity = game.addChild(new GreyEntity());
greyEntity.x = 2048 / 2;
greyEntity.y = 2732 / 2;
game.update = function () {
// Game update logic
testEntity.update();
greyEntity.update();
};
game.down = function (x, y, obj) {
// Handle touch or mouse down event
console.log("Game was touched at", x, y);
};
game.up = function (x, y, obj) {
// Handle touch or mouse up event
console.log("Touch released at", x, y);
};
// Create score text
var scoreTxt = new Text2('$1000', {
size: 120,
fill: 0x0ce729
});
scoreTxt.anchor.set(0.5, 0); // Sets anchor to the center of the top edge of the text.
LK.gui.top.addChild(scoreTxt); // Add the score text to the GUI overlay at the top-center of the screen.
// Initialize scoreTxt.text to avoid undefined error
scoreTxt.text = '$1000';
game.move = function (x, y, obj) {
// Handle touch or mouse move event
console.log("Moving at", x, y);
};