User prompt
player the burp sound every time seaman talk
User prompt
add the water sound and loop it
User prompt
add water sound at the begining and loop it
User prompt
remove new text logic
User prompt
text change every 5 second now
User prompt
new text spawn every 5 second
Code edit (1 edits merged)
Please save this source code
User prompt
move the text 30 pixel down
User prompt
move the text 50 pixel to the right and 50 pixel upper
User prompt
move the text 200 pixel to the left
User prompt
miove the buble 200 pixel to the right
User prompt
move the buble 100 pixel to the right
User prompt
double the size of the buble
User prompt
ajust to size of the buble to the size of the text
User prompt
move the text in the center of the buble
User prompt
center the text in the buble
User prompt
seaman need to talk to the player ezvery 2 second by trolling him
User prompt
remove the buble and shopw the trolling text in front of the seaman
User prompt
rewxrite the code and make it show the trolling text every 2 second
User prompt
i dont see the trolling text. Fix it
User prompt
the buble need to show the text speak by seaman
User prompt
fix the issue of the buble not showing the text
User prompt
the buble of text need to show the text speaker by seaman and following him
User prompt
seaman talk every 2 second and a buble of text is spawngin close to him like in a comic
/**** * Classes ****/ // Define the Food class var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Food update logic }; }); //<Assets used in the game will automatically appear here> // Define the Seaman class var Seaman = Container.expand(function () { var self = Container.call(this); var seamanGraphics = self.attachAsset('seaman', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Seaman update logic }; self.down = function (x, y, obj) { // Handle touch down event }; self.up = function (x, y, obj) { // Handle touch up event }; }); // Define the AI for the Seaman class var SeamanAI = Container.expand(function () { var self = Container.call(this); var seamanGraphics = self.attachAsset('seaman', { anchorX: 0.5, anchorY: 0.5 }); // Set initial direction and speed self.direction = Math.random() * Math.PI * 2; self.speed = 2; // Update function for the AI movement self.update = function () { // Calculate the new position var newX = self.x + Math.cos(self.direction) * self.speed; var newY = self.y + Math.sin(self.direction) * self.speed; // Check if the new position is inside the screen bounds if (newX < 0 || newX > 2048 || newY < 0 || newY > 2732) { // If not, change the direction self.direction += Math.PI; // And move the seaman back inside the screen bounds if (newX < 0) { newX = 0; } else if (newX > 2048) { newX = 2048; } if (newY < 0) { newY = 0; } else if (newY > 2732) { newY = 2732; } } // Update the position self.x = newX; self.y = newY; }; }); // Define the SpeechBubble class var SpeechBubble = Container.expand(function () { var self = Container.call(this); var text = new Text2('J\'adore one piece avec Sangoku lol', { size: 50, fill: "#000000", align: "center" }); text.anchor.set(0.5, 0.5); var bubbleGraphics = self.attachAsset('speechBubble', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.addChild(text); text.x = bubbleGraphics.width / 2 - 150; text.y = bubbleGraphics.height / 2 - text.height / 2 - 20; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize game variables var seaman; // Initialize game elements function initGame() { // Create and position the Seaman with AI seaman = game.addChild(new SeamanAI()); seaman.x = 2048 / 2; seaman.y = 2732 / 2; // Move the seaman sprite to the front seaman.zIndex = 1; // Add a speech bubble to the seaman var speechBubble = seaman.addChild(new SpeechBubble()); speechBubble.x = 300; speechBubble.y = -150; // Make the seaman talk every 2 seconds var phrases = ['Je vais dissoudre lassemblé', 'Traverse la rue', 'Je suis pas le pére noel', 'Brigite je peux avoir mon argent de poche ?']; var phraseIndex = 0; LK.setInterval(function () { speechBubble.children[1].setText(phrases[phraseIndex]); phraseIndex = (phraseIndex + 1) % phrases.length; // Play burp sound LK.getSound('burp').play(); }, 5000); // Create and position the Water var water = game.addChild(LK.getAsset('Water', { anchorX: 0.5, anchorY: 0.5 })); water.x = 2048 / 2; water.y = 2732 / 2; water.alpha = 0.1; // Make the water sprite 90 percent transparent } // Handle game update game.update = function () { // Update Seaman seaman.update(); }; // Remove touch down event handler game.down = function (x, y, obj) {}; // Handle touch up event game.up = function (x, y, obj) { // No action needed on touch up }; // Initialize the game initGame(); // Play water sound and loop it LK.getSound('Water').play({ loop: true }); // Play water sound and loop it LK.getSound('Water').play({ loop: true });
===================================================================
--- original.js
+++ change.js
@@ -115,8 +115,10 @@
var phraseIndex = 0;
LK.setInterval(function () {
speechBubble.children[1].setText(phrases[phraseIndex]);
phraseIndex = (phraseIndex + 1) % phrases.length;
+ // Play burp sound
+ LK.getSound('burp').play();
}, 5000);
// Create and position the Water
var water = game.addChild(LK.getAsset('Water', {
anchorX: 0.5,
fish food. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A fish with an Human male weird head in color in a realistic style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Realistic Water of an aquarium. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.