User prompt
Migrate to the latest version of LK
User prompt
Make the talk button allow to be click multiple time
User prompt
optimise the game with 5 thing
User prompt
optimise all the code
User prompt
Please fix the bug: 'ReferenceError: flirtyDialogueLines is not defined' in or related to this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 253
User prompt
add 10 new sentence
User prompt
Add 50 more dialogue array
User prompt
Add 50 more dialogue array
User prompt
Add 50 new dialogue array
User prompt
Add 30 new dialogue array
User prompt
add 20 new dialogue array
User prompt
Add 20 new dialogue array
User prompt
Add 10 new dialogue array
User prompt
Add 10 new dialogue
User prompt
add casualdialogue 2
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 75
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 71
User prompt
add 3 new casualdialogueline array with only 4 dialogue each
User prompt
add 10 new dialogue
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 85
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 76
User prompt
add two new casual dialogue array with 3 dialogue each
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 85
User prompt
Fix Bug: 'ReferenceError: casualDialogueLines is not defined' in this line: 'var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;' Line Number: 76
User prompt
add two new casual dialogue array with 3 dialogue each
/**** * Classes ****/ var FlirtyDialogue = Container.expand(function (text) { var self = Container.call(this); var bubbleGraphics = self.attachAsset('speechBubble', { anchorX: 0.5, anchorY: 0.5 }); var textElement = new Text2(text, { size: 94.5, fill: "#ff69b4" }); textElement.maxWidth = bubbleGraphics.width * 0.2; textElement.maxHeight = bubbleGraphics.height * 0.2; textElement.anchor.set(0.5, 0.5); self.addChild(bubbleGraphics); self.addChild(textElement); }); var LeftEye = Container.expand(function () { var self = Container.call(this); var eyeGraphics = self.attachAsset('eye', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(eyeGraphics); }); var Mouth = Container.expand(function () { var self = Container.call(this); var mouthGraphics = self.attachAsset('mouth', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(mouthGraphics); self.talking = false; self.talkScale = 1; self.update = function () { if (self.talking) { self.talkScale += 0.02; if (self.talkScale > 1.2) { self.talking = false; } } else { self.talkScale -= 0.02; if (self.talkScale < 1) { self.talkScale = 1; } } mouthGraphics.scale.set(self.talkScale); }; self.startTalking = function () { self.talking = true; }; self.stopTalking = function () { self.talking = false; }; }); var Nose = Container.expand(function () { var self = Container.call(this); var noseGraphics = self.attachAsset('nose', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(noseGraphics); }); var RightEye = Container.expand(function () { var self = Container.call(this); var eyeGraphics = self.attachAsset('eye', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(eyeGraphics); }); var RoomBackground = Container.expand(function () { var self = Container.call(this); var backgroundGraphics = self.attachAsset('roomBackground', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(backgroundGraphics); backgroundGraphics.width = 2048 * 1.3 * 1.2; backgroundGraphics.height = 2732 * 1.2; self.x = 2048 / 2; self.y = 2732 / 2 - 300; }); var SpeechBubble = Container.expand(function () { var self = Container.call(this); var bubbleGraphics = self.attachAsset('speechBubble', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(bubbleGraphics); self.visible = false; self.show = function (text, x, y) { self.x = x + 200; self.y = y + 100; self.visible = true; self.addChild(text); var dialogueText = text; LK.setTimeout(function () { self.visible = false; self.removeChild(dialogueText); }, 2000); }; }); var TalkButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('talkButton', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(buttonGraphics); self.x = buttonGraphics.width / 2 + 250; self.y = 2732 - buttonGraphics.height / 2 - 250; self.cooldown = false; var casualDialogueLines = ['Hello', 'Nice to see you', 'How are you today?', 'You look wonderful!', 'Missed you!', 'What brings you here today?', 'Did you sleep well?', 'Dream of me?', 'Ready for a new day?', 'You’re my sunshine!', 'Can’t wait to see you!', 'You mean the world to me!', 'Can I tell you a secret?', 'You make me smile!', 'I love spending time with you.', 'You make every day better.', 'I love our conversations.', 'You always know how to make me laugh.', 'I appreciate you.', 'You are so kind.', 'You make me feel special.', 'I love your company.']; var flirtyDialogueLines = ['I love you', 'Thinking of you makes my day!', 'You brighten up my world.', 'You have the key to my heart.', 'You make my heart skip a beat.']; self.on('down', function () { if (!self.cooldown && self.parent) { self.cooldown = true; var girlfriend = self.parent.children.find(function (child) { return child instanceof VirtualGirlfriend; }); var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines; if (girlfriend) { girlfriend.speak(dialogueLines[Math.floor(Math.random() * dialogueLines.length)]); } LK.setTimeout(function () { self.cooldown = false; }, 2100); } }); }); var VirtualGirlfriend = Container.expand(function () { var self = Container.call(this); var girlfriendGraphics = self.attachAsset('girlfriend', { anchorX: 0.5, anchorY: 0.5 }); self.x = 2048 / 2 - 50; self.y = 2732 - girlfriendGraphics.height + 1050; self.state = "breathing"; self.dialogue = ""; self.breathDuration = 180; self.breathCounter = 0; self.isBreathingIn = true; self.updateBreathing = function () { if (self.isBreathingIn) { self.breathCounter++; if (self.breathCounter >= self.breathDuration) { self.isBreathingIn = false; } } else { self.breathCounter--; if (self.breathCounter <= 0) { self.isBreathingIn = true; } } var scaleFactor = 1 + self.breathCounter / self.breathDuration * (0.05 / 3); this.scale.x = scaleFactor; this.scale.y = scaleFactor; }; self.update = function () { if (self.state === 'breathing' || self.state === 'talking') { self.updateBreathing(); } }; self.speak = function (dialogueTxt) { if (self.state !== 'talking') { self.state = 'talking'; self.dialogue = dialogueTxt; var speechBubble = new SpeechBubble(); var flirtyDialogue = new FlirtyDialogue(dialogueTxt); speechBubble.show(flirtyDialogue, self.x, self.y - 1200); self.parent.addChild(speechBubble); var mouth = self.parent.children.find(function (child) { return child instanceof Mouth; }); if (mouth) { mouth.startTalking(); } LK.setTimeout(function () { self.state = 'breathing'; if (mouth) { mouth.stopTalking(); } }, 2000); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.mouth = game.addChild(new Mouth()); var roomBackground = game.addChild(new RoomBackground()); roomBackground.x = 2048 / 2; roomBackground.y = 2732 / 2; var girlfriend = game.addChild(new VirtualGirlfriend()); game.mouth = game.addChild(new Mouth()); var leftEye = game.addChild(new LeftEye()); var rightEye = game.addChild(new RightEye()); var nose = game.addChild(new Nose()); LK.on('tick', function () { var breathScale = girlfriend.scale.x; leftEye.x = girlfriend.x - 110 * breathScale; leftEye.y = girlfriend.y - 200 * breathScale; rightEye.x = girlfriend.x + 300 * breathScale; rightEye.y = girlfriend.y - 210 * breathScale; nose.x = girlfriend.x + 95 * breathScale; nose.y = girlfriend.y - 40 * breathScale; var breathScale = girlfriend.scale.x; game.mouth.x = girlfriend.x + 95 * breathScale; game.mouth.y = girlfriend.y + 180 * breathScale; game.mouth.update(); girlfriend.update(); }); var dialogueTxt = new Text2('', { size: 150, fill: "#ffffff", x: 2048 / 2, y: 150 }); dialogueTxt.anchor.set(0.5, 0); LK.gui.top.addChild(dialogueTxt); var talkButton = game.addChild(new TalkButton()); dialogueTxt.anchor.set(.5, 0); LK.gui.top.addChild(dialogueTxt); LK.on('tick', function () { var breathScale = girlfriend.scale.x; girlfriend.update(); game.mouth.x = girlfriend.x + 95 * breathScale; game.mouth.y = girlfriend.y + 180 * breathScale; game.mouth.update(); });
===================================================================
--- original.js
+++ change.js
@@ -1,17 +1,51 @@
+/****
+* Classes
+****/
+var FlirtyDialogue = Container.expand(function (text) {
+ var self = Container.call(this);
+ var bubbleGraphics = self.attachAsset('speechBubble', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var textElement = new Text2(text, {
+ size: 94.5,
+ fill: "#ff69b4"
+ });
+ textElement.maxWidth = bubbleGraphics.width * 0.2;
+ textElement.maxHeight = bubbleGraphics.height * 0.2;
+ textElement.anchor.set(0.5, 0.5);
+ self.addChild(bubbleGraphics);
+ self.addChild(textElement);
+});
+var LeftEye = Container.expand(function () {
+ var self = Container.call(this);
+ var eyeGraphics = self.attachAsset('eye', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.addChild(eyeGraphics);
+});
var Mouth = Container.expand(function () {
var self = Container.call(this);
- var mouthGraphics = self.createAsset('mouth', 'Mouth Graphics', 0.5, 0.5);
+ var mouthGraphics = self.attachAsset('mouth', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(mouthGraphics);
self.talking = false;
self.talkScale = 1;
self.update = function () {
if (self.talking) {
self.talkScale += 0.02;
- if (self.talkScale > 1.2) self.talking = false;
+ if (self.talkScale > 1.2) {
+ self.talking = false;
+ }
} else {
self.talkScale -= 0.02;
- if (self.talkScale < 1) self.talkScale = 1;
+ if (self.talkScale < 1) {
+ self.talkScale = 1;
+ }
}
mouthGraphics.scale.set(self.talkScale);
};
self.startTalking = function () {
@@ -20,24 +54,42 @@
self.stopTalking = function () {
self.talking = false;
};
});
-var FlirtyDialogue = Container.expand(function (text) {
+var Nose = Container.expand(function () {
var self = Container.call(this);
- var bubbleGraphics = self.createAsset('speechBubble', 'Speech Bubble Graphics', 0.5, 0.5);
- var textElement = new Text2(text, {
- size: 94.5,
- fill: "#ff69b4"
+ var noseGraphics = self.attachAsset('nose', {
+ anchorX: 0.5,
+ anchorY: 0.5
});
- textElement.maxWidth = bubbleGraphics.width * 0.2;
- textElement.maxHeight = bubbleGraphics.height * 0.2;
- textElement.anchor.set(0.5, 0.5);
- self.addChild(bubbleGraphics);
- self.addChild(textElement);
+ self.addChild(noseGraphics);
});
+var RightEye = Container.expand(function () {
+ var self = Container.call(this);
+ var eyeGraphics = self.attachAsset('eye', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.addChild(eyeGraphics);
+});
+var RoomBackground = Container.expand(function () {
+ var self = Container.call(this);
+ var backgroundGraphics = self.attachAsset('roomBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.addChild(backgroundGraphics);
+ backgroundGraphics.width = 2048 * 1.3 * 1.2;
+ backgroundGraphics.height = 2732 * 1.2;
+ self.x = 2048 / 2;
+ self.y = 2732 / 2 - 300;
+});
var SpeechBubble = Container.expand(function () {
var self = Container.call(this);
- var bubbleGraphics = self.createAsset('speechBubble', 'Speech Bubble Graphics', 0.5, 0.5);
+ var bubbleGraphics = self.attachAsset('speechBubble', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(bubbleGraphics);
self.visible = false;
self.show = function (text, x, y) {
self.x = x + 200;
@@ -52,56 +104,40 @@
};
});
var TalkButton = Container.expand(function () {
var self = Container.call(this);
- var buttonGraphics = self.createAsset('talkButton', 'Talk Button Graphics', 0.5, 0.5);
+ var buttonGraphics = self.attachAsset('talkButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(buttonGraphics);
self.x = buttonGraphics.width / 2 + 250;
self.y = 2732 - buttonGraphics.height / 2 - 250;
self.cooldown = false;
- var casualDialogueLines = ['Hello', 'Nice to see you', 'How are you today?', 'You look wonderful!', 'Missed you!', 'What brings you here today?', 'Did you sleep well?', 'Dream of me?', 'Ready for a new day?', 'You’re my sunshine!', 'Can’t wait to see you!', 'You mean the world to me!', 'Can I tell you a secret?'];
+ var casualDialogueLines = ['Hello', 'Nice to see you', 'How are you today?', 'You look wonderful!', 'Missed you!', 'What brings you here today?', 'Did you sleep well?', 'Dream of me?', 'Ready for a new day?', 'You’re my sunshine!', 'Can’t wait to see you!', 'You mean the world to me!', 'Can I tell you a secret?', 'You make me smile!', 'I love spending time with you.', 'You make every day better.', 'I love our conversations.', 'You always know how to make me laugh.', 'I appreciate you.', 'You are so kind.', 'You make me feel special.', 'I love your company.'];
var flirtyDialogueLines = ['I love you', 'Thinking of you makes my day!', 'You brighten up my world.', 'You have the key to my heart.', 'You make my heart skip a beat.'];
self.on('down', function () {
if (!self.cooldown && self.parent) {
self.cooldown = true;
var girlfriend = self.parent.children.find(function (child) {
return child instanceof VirtualGirlfriend;
});
var dialogueLines = Math.random() < 0.5 ? casualDialogueLines : flirtyDialogueLines;
- if (girlfriend) girlfriend.speak(dialogueLines[Math.floor(Math.random() * dialogueLines.length)]);
+ if (girlfriend) {
+ girlfriend.speak(dialogueLines[Math.floor(Math.random() * dialogueLines.length)]);
+ }
LK.setTimeout(function () {
self.cooldown = false;
}, 2100);
}
});
});
-var RightEye = Container.expand(function () {
- var self = Container.call(this);
- var eyeGraphics = self.createAsset('eye', 'Right Eye Graphics', 0.5, 0.5);
- self.addChild(eyeGraphics);
-});
-var RoomBackground = Container.expand(function () {
- var self = Container.call(this);
- var backgroundGraphics = self.createAsset('roomBackground', 'Room Background', 0.5, 0.5);
- self.addChild(backgroundGraphics);
- backgroundGraphics.width = 2048 * 1.3 * 1.2;
- backgroundGraphics.height = 2732 * 1.2;
- self.x = 2048 / 2;
- self.y = 2732 / 2 - 300;
-});
-var LeftEye = Container.expand(function () {
- var self = Container.call(this);
- var eyeGraphics = self.createAsset('eye', 'Left Eye Graphics', 0.5, 0.5);
- self.addChild(eyeGraphics);
-});
-var Nose = Container.expand(function () {
- var self = Container.call(this);
- var noseGraphics = self.createAsset('nose', 'Nose Graphics', 0.5, 0.5);
- self.addChild(noseGraphics);
-});
var VirtualGirlfriend = Container.expand(function () {
var self = Container.call(this);
- var girlfriendGraphics = self.createAsset('girlfriend', 'Virtual Girlfriend', .5, .5);
+ var girlfriendGraphics = self.attachAsset('girlfriend', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.x = 2048 / 2 - 50;
self.y = 2732 - girlfriendGraphics.height + 1050;
self.state = "breathing";
self.dialogue = "";
@@ -139,56 +175,68 @@
self.parent.addChild(speechBubble);
var mouth = self.parent.children.find(function (child) {
return child instanceof Mouth;
});
- if (mouth) mouth.startTalking();
+ if (mouth) {
+ mouth.startTalking();
+ }
LK.setTimeout(function () {
self.state = 'breathing';
- if (mouth) mouth.stopTalking();
+ if (mouth) {
+ mouth.stopTalking();
+ }
}, 2000);
}
};
});
-var Game = Container.expand(function () {
- var self = Container.call(this);
- self.mouth = self.addChild(new Mouth());
- var roomBackground = self.addChild(new RoomBackground());
- roomBackground.x = 2048 / 2;
- roomBackground.y = 2732 / 2;
- var girlfriend = self.addChild(new VirtualGirlfriend());
- self.mouth = self.addChild(new Mouth());
- var leftEye = self.addChild(new LeftEye());
- var rightEye = self.addChild(new RightEye());
- var nose = self.addChild(new Nose());
- LK.on('tick', function () {
- var breathScale = girlfriend.scale.x;
- leftEye.x = girlfriend.x - 110 * breathScale;
- leftEye.y = girlfriend.y - 200 * breathScale;
- rightEye.x = girlfriend.x + 300 * breathScale;
- rightEye.y = girlfriend.y - 210 * breathScale;
- nose.x = girlfriend.x + 95 * breathScale;
- nose.y = girlfriend.y - 40 * breathScale;
- var breathScale = girlfriend.scale.x;
- self.mouth.x = girlfriend.x + 95 * breathScale;
- self.mouth.y = girlfriend.y + 180 * breathScale;
- self.mouth.update();
- girlfriend.update();
- });
- var dialogueTxt = new Text2('', {
- size: 150,
- fill: "#ffffff",
- x: 2048 / 2,
- y: 150
- });
- dialogueTxt.anchor.set(0.5, 0);
- LK.gui.topCenter.addChild(dialogueTxt);
- var talkButton = self.addChild(new TalkButton());
- dialogueTxt.anchor.set(.5, 0);
- LK.gui.topCenter.addChild(dialogueTxt);
- LK.on('tick', function () {
- var breathScale = girlfriend.scale.x;
- girlfriend.update();
- self.mouth.x = girlfriend.x + 95 * breathScale;
- self.mouth.y = girlfriend.y + 180 * breathScale;
- self.mouth.update();
- });
+
+/****
+* Initialize Game
+****/
+var game = new LK.Game({
+ backgroundColor: 0x000000
});
+
+/****
+* Game Code
+****/
+game.mouth = game.addChild(new Mouth());
+var roomBackground = game.addChild(new RoomBackground());
+roomBackground.x = 2048 / 2;
+roomBackground.y = 2732 / 2;
+var girlfriend = game.addChild(new VirtualGirlfriend());
+game.mouth = game.addChild(new Mouth());
+var leftEye = game.addChild(new LeftEye());
+var rightEye = game.addChild(new RightEye());
+var nose = game.addChild(new Nose());
+LK.on('tick', function () {
+ var breathScale = girlfriend.scale.x;
+ leftEye.x = girlfriend.x - 110 * breathScale;
+ leftEye.y = girlfriend.y - 200 * breathScale;
+ rightEye.x = girlfriend.x + 300 * breathScale;
+ rightEye.y = girlfriend.y - 210 * breathScale;
+ nose.x = girlfriend.x + 95 * breathScale;
+ nose.y = girlfriend.y - 40 * breathScale;
+ var breathScale = girlfriend.scale.x;
+ game.mouth.x = girlfriend.x + 95 * breathScale;
+ game.mouth.y = girlfriend.y + 180 * breathScale;
+ game.mouth.update();
+ girlfriend.update();
+});
+var dialogueTxt = new Text2('', {
+ size: 150,
+ fill: "#ffffff",
+ x: 2048 / 2,
+ y: 150
+});
+dialogueTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(dialogueTxt);
+var talkButton = game.addChild(new TalkButton());
+dialogueTxt.anchor.set(.5, 0);
+LK.gui.top.addChild(dialogueTxt);
+LK.on('tick', function () {
+ var breathScale = girlfriend.scale.x;
+ girlfriend.update();
+ game.mouth.x = girlfriend.x + 95 * breathScale;
+ game.mouth.y = girlfriend.y + 180 * breathScale;
+ game.mouth.update();
+});
\ No newline at end of file
A beautiful woman in a anime style with no eye, no eyebrow and no mouth. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An eye in a anime style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A beautiful and slim nose in a anime style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A beautiful women mouth in a manga style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A restaurant background in a anime style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A talk button with a buble and a word 'talk'. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A ta dialogue text buble in anime style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.