User prompt
ad age up ten years
User prompt
ai generated choices based on age infinite possible choices but age based and answers are age base
User prompt
now make decisions that makes sense based on age
User prompt
show age at top corner of screen
User prompt
age shower that shows you your age
User prompt
add more possible decisions infinite decisions
User prompt
add a age up one year age up one day age up one week age up 1 month choice
User prompt
add one day age up and if you age up one day decision time add parents inthegame also ... other stuff to do later you can move the character
Code edit (1 edits merged)
Please save this source code
User prompt
Life Clicker: Age Up Adventure
Initial prompt
a game where you start as a newborn baby age up a year when the player wants you too and live a life
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// AgeUpButton class
var AgeUpButton = Container.expand(function () {
var self = Container.call(this);
var btn = self.attachAsset('ageup_btn', {
anchorX: 0.5,
anchorY: 0.5
});
var label = new Text2('Age Up', {
size: 70,
fill: 0xFFFFFF
});
label.anchor.set(0.5, 0.5);
label.x = 0;
label.y = 0;
self.addChild(label);
// For click feedback
self.flash = function () {
tween(btn, {
tint: 0x80ff80
}, {
duration: 100,
onFinish: function onFinish() {
tween(btn, {
tint: 0x43aa8b
}, {
duration: 200
});
}
});
};
return self;
});
// Avatar class for displaying the character at different ages
var Avatar = Container.expand(function () {
var self = Container.call(this);
// Default to baby
self.stage = 'baby';
self.avatarNode = null;
self.setStage = function (stage) {
self.stage = stage;
if (self.avatarNode) {
self.avatarNode.destroy();
}
var assetId = 'avatar_' + stage;
self.avatarNode = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
};
// Initialize as baby
self.setStage('baby');
return self;
});
// EventPopup class for showing milestone or choice events
var EventPopup = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('event_bg', {
anchorX: 0.5,
anchorY: 0.5
});
self.text = new Text2('', {
size: 60,
fill: 0x222222,
wordWrap: true,
wordWrapWidth: 1100
});
self.text.anchor.set(0.5, 0.5);
self.text.x = 0;
self.text.y = -100;
self.addChild(self.text);
// Option buttons (max 2 for MVP)
self.optionBtns = [];
// Show popup with text and options
self.show = function (text, options) {
self.text.setText(text);
// Remove old buttons
for (var i = 0; i < self.optionBtns.length; i++) {
self.optionBtns[i].destroy();
}
self.optionBtns = [];
// Create new buttons
var btnY = 120;
for (var i = 0; i < options.length; i++) {
(function (idx) {
var opt = options[idx];
var btn = new Container();
var btnBg = btn.attachAsset('ageup_btn', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 100
});
btn.x = 0;
btn.y = btnY + idx * 130;
var btnLabel = new Text2(opt.text, {
size: 48,
fill: 0xFFFFFF
});
btnLabel.anchor.set(0.5, 0.5);
btn.addChild(btnLabel);
btn.down = function (x, y, obj) {
// Animate feedback
tween(btnBg, {
tint: 0x80ff80
}, {
duration: 100,
onFinish: function onFinish() {
tween(btnBg, {
tint: 0x43aa8b
}, {
duration: 200
});
}
});
// Call option handler
if (opt.onSelect) {
opt.onSelect();
}
};
self.addChild(btn);
self.optionBtns.push(btn);
})(i);
}
};
// Hide popup
self.hide = function () {
for (var i = 0; i < self.optionBtns.length; i++) {
self.optionBtns[i].destroy();
}
self.optionBtns = [];
self.text.setText('');
self.visible = false;
};
// Start hidden
self.visible = false;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xf7f7f7
});
/****
* Game Code
****/
// Event popup background
// Button for "Age Up"
// Character avatars for each life stage (baby, child, teen, adult, elder)
// Life stages and their age ranges
var lifeStages = [{
stage: 'baby',
min: 0,
max: 2
}, {
stage: 'child',
min: 3,
max: 12
}, {
stage: 'teen',
min: 13,
max: 19
}, {
stage: 'adult',
min: 20,
max: 64
}, {
stage: 'elder',
min: 65,
max: 120
}];
// Milestone events per age (MVP: a few per stage)
var milestoneEvents = {
0: {
text: "Welcome to the world! You are a newborn baby.",
options: [{
text: "Continue"
}]
},
1: {
text: "You take your first steps!",
options: [{
text: "Yay!"
}]
},
5: {
text: "You start school. Do you want to make a new friend?",
options: [{
text: "Yes",
onSelect: function onSelect() {
showEvent("You made a new friend!");
}
}, {
text: "No",
onSelect: function onSelect() {
showEvent("You prefer to play alone for now.");
}
}]
},
13: {
text: "You become a teenager. Time for high school!",
options: [{
text: "Bring it on!"
}]
},
18: {
text: "You graduate high school. What will you do?",
options: [{
text: "Go to college",
onSelect: function onSelect() {
showEvent("You start college life!");
}
}, {
text: "Start working",
onSelect: function onSelect() {
showEvent("You get your first job!");
}
}]
},
30: {
text: "You reach adulthood. Do you want to travel?",
options: [{
text: "Yes",
onSelect: function onSelect() {
showEvent("You see the world and gain new experiences!");
}
}, {
text: "No",
onSelect: function onSelect() {
showEvent("You focus on your career.");
}
}]
},
65: {
text: "You retire! Time to relax and enjoy your golden years.",
options: [{
text: "Celebrate"
}]
},
90: {
text: "You reflect on a life well lived.",
options: [{
text: "The End"
}]
}
};
// Helper to get stage by age
function getStageByAge(age) {
for (var i = 0; i < lifeStages.length; i++) {
if (age >= lifeStages[i].min && age <= lifeStages[i].max) {
return lifeStages[i].stage;
}
}
return 'elder';
}
// Game state
var age = 0;
var maxAge = 100;
var avatar = null;
var ageUpBtn = null;
var ageText = null;
var eventPopup = null;
var milestoneShown = {}; // To avoid showing same milestone twice
// Center positions
var centerX = 2048 / 2;
var centerY = 2732 / 2;
// Add avatar
avatar = new Avatar();
avatar.x = centerX;
avatar.y = centerY - 350;
game.addChild(avatar);
// Age text
ageText = new Text2('Age: 0', {
size: 120,
fill: 0x333333
});
ageText.anchor.set(0.5, 0);
ageText.x = centerX;
ageText.y = 200;
game.addChild(ageText);
// Age Up button
ageUpBtn = new AgeUpButton();
ageUpBtn.x = centerX;
ageUpBtn.y = centerY + 500;
game.addChild(ageUpBtn);
// Event popup
eventPopup = new EventPopup();
eventPopup.x = centerX;
eventPopup.y = centerY;
game.addChild(eventPopup);
// Show event helper
function showEvent(text, options) {
eventPopup.visible = true;
if (!options) {
options = [{
text: "OK",
onSelect: function onSelect() {
eventPopup.hide();
}
}];
}
eventPopup.show(text, options);
}
// Show milestone if available
function checkMilestone() {
if (milestoneEvents[age] && !milestoneShown[age]) {
milestoneShown[age] = true;
var event = milestoneEvents[age];
// Wrap options to always hide popup after selection
var opts = [];
for (var i = 0; i < event.options.length; i++) {
(function (idx) {
var opt = event.options[idx];
opts.push({
text: opt.text,
onSelect: function onSelect() {
if (opt.onSelect) opt.onSelect();
eventPopup.hide();
}
});
})(i);
}
showEvent(event.text, opts);
}
}
// Age up logic
function doAgeUp() {
if (eventPopup.visible) return; // Don't age up while popup is open
if (age >= maxAge) return;
age += 1;
ageText.setText('Age: ' + age);
// Animate avatar "growing"
tween(avatar, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 120,
onFinish: function onFinish() {
tween(avatar, {
scaleX: 1,
scaleY: 1
}, {
duration: 120
});
}
});
// Update avatar stage if needed
var newStage = getStageByAge(age);
if (avatar.stage !== newStage) {
avatar.setStage(newStage);
}
// Show milestone if any
checkMilestone();
// End of life
if (age === maxAge) {
LK.effects.flashScreen(0x000000, 1200);
LK.showGameOver();
}
}
// Age up button event
ageUpBtn.down = function (x, y, obj) {
ageUpBtn.flash();
doAgeUp();
};
// Also allow clicking anywhere on avatar to age up
avatar.down = function (x, y, obj) {
doAgeUp();
};
// Prevent interaction when popup is open
game.down = function (x, y, obj) {
if (eventPopup.visible) {
// Dismiss popup if click outside options
eventPopup.hide();
}
};
// Show first milestone at start
checkMilestone();
// No need for update loop for MVP
// GUI: Show age at top center
LK.gui.top.addChild(ageText); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,390 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// AgeUpButton class
+var AgeUpButton = Container.expand(function () {
+ var self = Container.call(this);
+ var btn = self.attachAsset('ageup_btn', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var label = new Text2('Age Up', {
+ size: 70,
+ fill: 0xFFFFFF
+ });
+ label.anchor.set(0.5, 0.5);
+ label.x = 0;
+ label.y = 0;
+ self.addChild(label);
+ // For click feedback
+ self.flash = function () {
+ tween(btn, {
+ tint: 0x80ff80
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(btn, {
+ tint: 0x43aa8b
+ }, {
+ duration: 200
+ });
+ }
+ });
+ };
+ return self;
+});
+// Avatar class for displaying the character at different ages
+var Avatar = Container.expand(function () {
+ var self = Container.call(this);
+ // Default to baby
+ self.stage = 'baby';
+ self.avatarNode = null;
+ self.setStage = function (stage) {
+ self.stage = stage;
+ if (self.avatarNode) {
+ self.avatarNode.destroy();
+ }
+ var assetId = 'avatar_' + stage;
+ self.avatarNode = self.attachAsset(assetId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ };
+ // Initialize as baby
+ self.setStage('baby');
+ return self;
+});
+// EventPopup class for showing milestone or choice events
+var EventPopup = Container.expand(function () {
+ var self = Container.call(this);
+ var bg = self.attachAsset('event_bg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.text = new Text2('', {
+ size: 60,
+ fill: 0x222222,
+ wordWrap: true,
+ wordWrapWidth: 1100
+ });
+ self.text.anchor.set(0.5, 0.5);
+ self.text.x = 0;
+ self.text.y = -100;
+ self.addChild(self.text);
+ // Option buttons (max 2 for MVP)
+ self.optionBtns = [];
+ // Show popup with text and options
+ self.show = function (text, options) {
+ self.text.setText(text);
+ // Remove old buttons
+ for (var i = 0; i < self.optionBtns.length; i++) {
+ self.optionBtns[i].destroy();
+ }
+ self.optionBtns = [];
+ // Create new buttons
+ var btnY = 120;
+ for (var i = 0; i < options.length; i++) {
+ (function (idx) {
+ var opt = options[idx];
+ var btn = new Container();
+ var btnBg = btn.attachAsset('ageup_btn', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 500,
+ height: 100
+ });
+ btn.x = 0;
+ btn.y = btnY + idx * 130;
+ var btnLabel = new Text2(opt.text, {
+ size: 48,
+ fill: 0xFFFFFF
+ });
+ btnLabel.anchor.set(0.5, 0.5);
+ btn.addChild(btnLabel);
+ btn.down = function (x, y, obj) {
+ // Animate feedback
+ tween(btnBg, {
+ tint: 0x80ff80
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(btnBg, {
+ tint: 0x43aa8b
+ }, {
+ duration: 200
+ });
+ }
+ });
+ // Call option handler
+ if (opt.onSelect) {
+ opt.onSelect();
+ }
+ };
+ self.addChild(btn);
+ self.optionBtns.push(btn);
+ })(i);
+ }
+ };
+ // Hide popup
+ self.hide = function () {
+ for (var i = 0; i < self.optionBtns.length; i++) {
+ self.optionBtns[i].destroy();
+ }
+ self.optionBtns = [];
+ self.text.setText('');
+ self.visible = false;
+ };
+ // Start hidden
+ self.visible = false;
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0xf7f7f7
+});
+
+/****
+* Game Code
+****/
+// Event popup background
+// Button for "Age Up"
+// Character avatars for each life stage (baby, child, teen, adult, elder)
+// Life stages and their age ranges
+var lifeStages = [{
+ stage: 'baby',
+ min: 0,
+ max: 2
+}, {
+ stage: 'child',
+ min: 3,
+ max: 12
+}, {
+ stage: 'teen',
+ min: 13,
+ max: 19
+}, {
+ stage: 'adult',
+ min: 20,
+ max: 64
+}, {
+ stage: 'elder',
+ min: 65,
+ max: 120
+}];
+// Milestone events per age (MVP: a few per stage)
+var milestoneEvents = {
+ 0: {
+ text: "Welcome to the world! You are a newborn baby.",
+ options: [{
+ text: "Continue"
+ }]
+ },
+ 1: {
+ text: "You take your first steps!",
+ options: [{
+ text: "Yay!"
+ }]
+ },
+ 5: {
+ text: "You start school. Do you want to make a new friend?",
+ options: [{
+ text: "Yes",
+ onSelect: function onSelect() {
+ showEvent("You made a new friend!");
+ }
+ }, {
+ text: "No",
+ onSelect: function onSelect() {
+ showEvent("You prefer to play alone for now.");
+ }
+ }]
+ },
+ 13: {
+ text: "You become a teenager. Time for high school!",
+ options: [{
+ text: "Bring it on!"
+ }]
+ },
+ 18: {
+ text: "You graduate high school. What will you do?",
+ options: [{
+ text: "Go to college",
+ onSelect: function onSelect() {
+ showEvent("You start college life!");
+ }
+ }, {
+ text: "Start working",
+ onSelect: function onSelect() {
+ showEvent("You get your first job!");
+ }
+ }]
+ },
+ 30: {
+ text: "You reach adulthood. Do you want to travel?",
+ options: [{
+ text: "Yes",
+ onSelect: function onSelect() {
+ showEvent("You see the world and gain new experiences!");
+ }
+ }, {
+ text: "No",
+ onSelect: function onSelect() {
+ showEvent("You focus on your career.");
+ }
+ }]
+ },
+ 65: {
+ text: "You retire! Time to relax and enjoy your golden years.",
+ options: [{
+ text: "Celebrate"
+ }]
+ },
+ 90: {
+ text: "You reflect on a life well lived.",
+ options: [{
+ text: "The End"
+ }]
+ }
+};
+// Helper to get stage by age
+function getStageByAge(age) {
+ for (var i = 0; i < lifeStages.length; i++) {
+ if (age >= lifeStages[i].min && age <= lifeStages[i].max) {
+ return lifeStages[i].stage;
+ }
+ }
+ return 'elder';
+}
+// Game state
+var age = 0;
+var maxAge = 100;
+var avatar = null;
+var ageUpBtn = null;
+var ageText = null;
+var eventPopup = null;
+var milestoneShown = {}; // To avoid showing same milestone twice
+// Center positions
+var centerX = 2048 / 2;
+var centerY = 2732 / 2;
+// Add avatar
+avatar = new Avatar();
+avatar.x = centerX;
+avatar.y = centerY - 350;
+game.addChild(avatar);
+// Age text
+ageText = new Text2('Age: 0', {
+ size: 120,
+ fill: 0x333333
+});
+ageText.anchor.set(0.5, 0);
+ageText.x = centerX;
+ageText.y = 200;
+game.addChild(ageText);
+// Age Up button
+ageUpBtn = new AgeUpButton();
+ageUpBtn.x = centerX;
+ageUpBtn.y = centerY + 500;
+game.addChild(ageUpBtn);
+// Event popup
+eventPopup = new EventPopup();
+eventPopup.x = centerX;
+eventPopup.y = centerY;
+game.addChild(eventPopup);
+// Show event helper
+function showEvent(text, options) {
+ eventPopup.visible = true;
+ if (!options) {
+ options = [{
+ text: "OK",
+ onSelect: function onSelect() {
+ eventPopup.hide();
+ }
+ }];
+ }
+ eventPopup.show(text, options);
+}
+// Show milestone if available
+function checkMilestone() {
+ if (milestoneEvents[age] && !milestoneShown[age]) {
+ milestoneShown[age] = true;
+ var event = milestoneEvents[age];
+ // Wrap options to always hide popup after selection
+ var opts = [];
+ for (var i = 0; i < event.options.length; i++) {
+ (function (idx) {
+ var opt = event.options[idx];
+ opts.push({
+ text: opt.text,
+ onSelect: function onSelect() {
+ if (opt.onSelect) opt.onSelect();
+ eventPopup.hide();
+ }
+ });
+ })(i);
+ }
+ showEvent(event.text, opts);
+ }
+}
+// Age up logic
+function doAgeUp() {
+ if (eventPopup.visible) return; // Don't age up while popup is open
+ if (age >= maxAge) return;
+ age += 1;
+ ageText.setText('Age: ' + age);
+ // Animate avatar "growing"
+ tween(avatar, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 120,
+ onFinish: function onFinish() {
+ tween(avatar, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 120
+ });
+ }
+ });
+ // Update avatar stage if needed
+ var newStage = getStageByAge(age);
+ if (avatar.stage !== newStage) {
+ avatar.setStage(newStage);
+ }
+ // Show milestone if any
+ checkMilestone();
+ // End of life
+ if (age === maxAge) {
+ LK.effects.flashScreen(0x000000, 1200);
+ LK.showGameOver();
+ }
+}
+// Age up button event
+ageUpBtn.down = function (x, y, obj) {
+ ageUpBtn.flash();
+ doAgeUp();
+};
+// Also allow clicking anywhere on avatar to age up
+avatar.down = function (x, y, obj) {
+ doAgeUp();
+};
+// Prevent interaction when popup is open
+game.down = function (x, y, obj) {
+ if (eventPopup.visible) {
+ // Dismiss popup if click outside options
+ eventPopup.hide();
+ }
+};
+// Show first milestone at start
+checkMilestone();
+// No need for update loop for MVP
+// GUI: Show age at top center
+LK.gui.top.addChild(ageText);
\ No newline at end of file