User prompt
When you reach 3000 clicks everything is automated ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When you reach 2500 clicks there is a message below the click counter saying: congratulations on getting here but it's not done yet
User prompt
When you reach 400 clicks the red cube is automated ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When you reach 250 clicks a red triangle appears at the left of the cube that boost all clicks by 1.25 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When you reach 750 clicks the green circle is automated ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When you reach 1000 clicks add a blue hexagon above the cube that multiples the clicks per click by 1.5 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When the cube has been clicked 500 times add a green circle under the cube that gives 2 clicks per click ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When you reach 100 clicks the green cube automatically clicks itself ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Cube Clicker
Initial prompt
Make a game about clicking a cube to get points
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Cube = Container.expand(function () {
var self = Container.call(this);
var cubeGraphics = self.attachAsset('cube', {
anchorX: 0.5,
anchorY: 0.5
});
// Color variations for click feedback
var originalColor = 0x4a90e2;
var clickColor = 0x7bb3f0;
self.onClick = function () {
// Award points
LK.setScore(LK.getScore() + 1);
// Increment click counter
clickCount++;
// Check if we've reached 100 clicks to enable auto-click
if (clickCount >= 100 && !autoClickActive) {
autoClickActive = true;
}
// Visual feedback - color flash
cubeGraphics.tint = clickColor;
tween(cubeGraphics, {
tint: originalColor
}, {
duration: 200
});
// Visual feedback - scale animation
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeIn
});
}
});
// Play click sound
LK.getSound('click').play();
// Update score display
if (scoreTxt) {
scoreTxt.setText(LK.getScore());
}
};
self.down = function (x, y, obj) {
self.onClick();
};
return self;
});
var GreenCircle = Container.expand(function () {
var self = Container.call(this);
var circleGraphics = self.attachAsset('greenCircle', {
anchorX: 0.5,
anchorY: 0.5
});
// Color variations for click feedback
var originalColor = 0x00ff00;
var clickColor = 0x66ff66;
self.onClick = function () {
// Award 2 points (2 clicks worth)
LK.setScore(LK.getScore() + 2);
// Increment click counter by 2
clickCount += 2;
// Visual feedback - color flash
circleGraphics.tint = clickColor;
tween(circleGraphics, {
tint: originalColor
}, {
duration: 200
});
// Visual feedback - scale animation
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeIn
});
}
});
// Play click sound
LK.getSound('click').play();
// Update score display
if (scoreTxt) {
scoreTxt.setText(LK.getScore());
}
};
self.down = function (x, y, obj) {
self.onClick();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2c3e50
});
/****
* Game Code
****/
// Create score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.setText(LK.getScore());
LK.gui.top.addChild(scoreTxt);
// Position score text with some padding from top
scoreTxt.y = 100;
// Track click count for auto-click feature
var clickCount = 0;
var autoClickActive = false;
var greenCircleActive = false;
var greenCircle = null;
// Create the main cube
var cube = game.addChild(new Cube());
// Position cube at center of screen
cube.x = 2048 / 2;
cube.y = 2732 / 2;
// Game update loop
game.update = function () {
// Auto-click functionality when 100 clicks reached
if (autoClickActive && LK.ticks % 60 === 0) {
// Auto-click every second (60 ticks)
cube.onClick();
}
// Check if we've reached 500 clicks to spawn green circle
if (clickCount >= 500 && !greenCircleActive) {
greenCircleActive = true;
greenCircle = game.addChild(new GreenCircle());
// Position green circle under the cube
greenCircle.x = 2048 / 2;
greenCircle.y = 2732 / 2 + 200;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -59,8 +59,58 @@
self.onClick();
};
return self;
});
+var GreenCircle = Container.expand(function () {
+ var self = Container.call(this);
+ var circleGraphics = self.attachAsset('greenCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Color variations for click feedback
+ var originalColor = 0x00ff00;
+ var clickColor = 0x66ff66;
+ self.onClick = function () {
+ // Award 2 points (2 clicks worth)
+ LK.setScore(LK.getScore() + 2);
+ // Increment click counter by 2
+ clickCount += 2;
+ // Visual feedback - color flash
+ circleGraphics.tint = clickColor;
+ tween(circleGraphics, {
+ tint: originalColor
+ }, {
+ duration: 200
+ });
+ // Visual feedback - scale animation
+ tween(self, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(self, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 100,
+ easing: tween.easeIn
+ });
+ }
+ });
+ // Play click sound
+ LK.getSound('click').play();
+ // Update score display
+ if (scoreTxt) {
+ scoreTxt.setText(LK.getScore());
+ }
+ };
+ self.down = function (x, y, obj) {
+ self.onClick();
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -83,8 +133,10 @@
scoreTxt.y = 100;
// Track click count for auto-click feature
var clickCount = 0;
var autoClickActive = false;
+var greenCircleActive = false;
+var greenCircle = null;
// Create the main cube
var cube = game.addChild(new Cube());
// Position cube at center of screen
cube.x = 2048 / 2;
@@ -95,5 +147,13 @@
if (autoClickActive && LK.ticks % 60 === 0) {
// Auto-click every second (60 ticks)
cube.onClick();
}
+ // Check if we've reached 500 clicks to spawn green circle
+ if (clickCount >= 500 && !greenCircleActive) {
+ greenCircleActive = true;
+ greenCircle = game.addChild(new GreenCircle());
+ // Position green circle under the cube
+ greenCircle.x = 2048 / 2;
+ greenCircle.y = 2732 / 2 + 200;
+ }
};
\ No newline at end of file