User prompt
Add the dragge again to the greenarea to move all togather
User prompt
Remove what's preventing statuescoretext from reducing by 100 when i click on any cover!
User prompt
Add click count for grey objects to reduce -100 from score but not from the greenarea!
User prompt
Reduce 100 from clicking on the specific grey only.
User prompt
Count only from click on grey object
User prompt
Don't count clicks from green area
User prompt
Let the greenarea asset when the grey is removed
User prompt
Add greenarea asset before each grey object with same size.
User prompt
reduce the statue by 100 when i click grey object
User prompt
Add statuescoretext of 1000
User prompt
Add statuescore for the game 1000
User prompt
Add statue count clicks from grey objects by -100
User prompt
Remove score text from game
User prompt
Reduce he score by 100 not deduct by 100.
User prompt
Don't decrease the score by 100 ducate it by 100 then.
User prompt
Don't remove the greenarea when i click on the grey assets!
User prompt
Add click event if i click any grey asset remove 100 from global score.
User prompt
cover it with the 9 assets greys
User prompt
add it to the game
User prompt
Remove testentity
User prompt
If i click any grey deduct score by 100 and remove it.
User prompt
If i click any grey decrease score by 100 and remove it.
User prompt
Add class of all grey cover 1 2 3 4 5 6 7 8 9
User prompt
Remove greyentity from game and its asset
User prompt
Decrease the global score by $100 for each click on grey objects. Hide the clicked grey object after 1 click.
/**** * Classes ****/ var Grey1 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey1', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey1 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey2 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey2', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey2 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey3 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey3', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey3 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey4 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey4', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey4 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey5 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey5', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey5 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey6 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey6', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey6 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey7 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey7', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey7 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey8 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey8', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey8 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var Grey9 = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('grey9', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for Grey9 }; self.down = function (x, y, obj) { // Decrease score by 100 LK.setScore(LK.getScore() - 100); // Count the click on grey object and reduce score by 100 // Remove the grey asset if (!(self instanceof TestEntity)) { self.destroy(); } }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); var TestEntity = Container.expand(function () { var self = Container.call(this); var entityGraphics = self.attachAsset('greenarea', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for TestEntity }; self.down = function (x, y, obj) { // Set the entity as the drag node dragNode = self; }; self.up = function (x, y, obj) { // Release the drag node dragNode = null; }; }); /**** * Initialize Game ****/ //<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 game = new LK.Game({ backgroundColor: 0x888888 //Init game with black background }); /**** * Game Code ****/ //<Write game logic code here, including initializing arrays and variables> var dragNode = null; // Variable to track the node being dragged var statueScore = 1000; // Initialize statueScore to 1000 // Create and display the statueScoreText var statueScoreText = new Text2('Statue Score: ' + statueScore, { size: 100, fill: 0xFFFFFF }); statueScoreText.anchor.set(0.5, 0); // Center the text horizontally LK.gui.top.addChild(statueScoreText); // Add the text to the top of the screen var positions = [{ x: 2048 / 2, y: 2732 / 2 }, { x: 2048 / 2, y: 2732 / 2 - 800 }, { x: 2048 / 2, y: 2732 / 2 + 800 }, { x: 2048 / 2 - 800, y: 2732 / 2 }, { x: 2048 / 2 + 800, y: 2732 / 2 - 800 }, { x: 2048 / 2 - 800, y: 2732 / 2 - 800 }, { x: 2048 / 2 + 800, y: 2732 / 2 + 800 }, { x: 2048 / 2 - 800, y: 2732 / 2 + 800 }, { x: 2048 / 2 + 800, y: 2732 / 2 }]; var greyEntities = []; var greyClasses = [Grey1, Grey2, Grey3, Grey4, Grey5, Grey6, Grey7, Grey8, Grey9]; positions.forEach(function (pos, index) { var greyEntity = new greyClasses[index](); greyEntity.x = pos.x; greyEntity.y = pos.y; game.addChild(greyEntity); greyEntities.push(greyEntity); }); game.update = function () { // Game update logic }; 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); }; game.move = function (x, y, obj) { // Handle touch or mouse move event if (dragNode) { // Calculate the offset from the dragNode's original position var offsetX = x - dragNode.x; var offsetY = y - dragNode.y; // Move all TestEntity objects by the same offset game.children.forEach(function (child) { if (child instanceof TestEntity) { child.x += offsetX; child.y += offsetY; } }); } console.log("Moving at", x, y); };
===================================================================
--- original.js
+++ change.js
@@ -242,8 +242,15 @@
****/
//<Write game logic code here, including initializing arrays and variables>
var dragNode = null; // Variable to track the node being dragged
var statueScore = 1000; // Initialize statueScore to 1000
+// Create and display the statueScoreText
+var statueScoreText = new Text2('Statue Score: ' + statueScore, {
+ size: 100,
+ fill: 0xFFFFFF
+});
+statueScoreText.anchor.set(0.5, 0); // Center the text horizontally
+LK.gui.top.addChild(statueScoreText); // Add the text to the top of the screen
var positions = [{
x: 2048 / 2,
y: 2732 / 2
}, {