Code edit (5 edits merged)
Please save this source code
User prompt
que este ubicado 1/4 de pantalla de abajo arriba
User prompt
baja su posición para que este en la parte inferior
User prompt
haz que el ancho y largo del menu sea todo el cuadrado inferior desde la mitad de la pantalla
User prompt
crea una interfaz con el asset menuBox que se encuentre en la parte inferior
User prompt
cambia el nick de currencyBox a menuBox
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'meterText.x = currencyBox.x - currencyBox.width / 2;' Line Number: 170
User prompt
haz que la variable se muestre en frente de currency box
User prompt
el texto no se muestra
User prompt
agrega un texto que muestre la variable meters
User prompt
los textos no son visibles
User prompt
agrega un texto que muestre la variable metros, debajo la de giros y debajo la de economia
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'girosText is not defined' in or related to this line: 'girosText.x = 50;' Line Number: 184
User prompt
quita de la escena el objeto creado de nombre "text"
User prompt
Elimina el asset creado de nombre text
User prompt
Please fix the bug: 'GirosText is not defined' in or related to this line: 'var girosText = game.addChild(new GirosText());' Line Number: 165
User prompt
Please fix the bug: 'MoneyText is not defined' in or related to this line: 'var moneyText = game.addChild(new MoneyText());' Line Number: 141
User prompt
Please fix the bug: 'MeterText is not defined' in or related to this line: 'var meterText = game.addChild(new MeterText());' Line Number: 115
User prompt
elimina los textos "meters, spins y currency"
User prompt
los textos meters y currency no se muestran
User prompt
vuelve al objeto currency box una interfaz
User prompt
corrige el error donde los textos se desplazan de lugar y regresalos a su posición original
User prompt
cambia el width a 650
User prompt
cambia su posición a 200
/**** * Classes ****/ // Create a GirosText instance and add it to the game var CurrencyBox = Container.expand(function () { var self = Container.call(this); // Attach a currencyBox asset to represent the currencyBox var currencyBoxGraphics = self.attachAsset('currencyBox', { anchorX: 0.5, anchorY: 0.5, x: 300, y: 400, width: 650, height: 430 }); }); // Create a GirosText class var GirosText = Container.expand(function () { var self = Container.call(this); // Attach a text asset to represent the giros text var girosTextGraphics = self.attachAsset('text', { anchorX: 0.5, anchorY: 0.5, text: 'Giros: 0', style: { fill: '#ffffff', fontSize: 50 } }); // This is automatically called every game tick, if the giros text is attached! self.update = function () { girosTextGraphics.text = 'Giros: ' + giros; }; }); // Create a MeterText class var MeterText = Container.expand(function () { var self = Container.call(this); // Attach a text asset to represent the meter text var meterTextGraphics = self.attachAsset('text', { anchorX: 0.5, anchorY: 0.5, text: 'Meters: 0', style: { fill: '#ffffff', fontSize: 50 } }); // This is automatically called every game tick, if the meter text is attached! self.update = function () { meterTextGraphics.text = 'Meters: ' + meters; }; }); // Create a MetrosText class var MetrosText = Container.expand(function () { var self = Container.call(this); // Attach a text asset to represent the metros text var metrosTextGraphics = self.attachAsset('text', { anchorX: 0.5, anchorY: 0.5, text: 'Metros: 0', style: { fill: '#ffffff', fontSize: 50 } }); // This is automatically called every game tick, if the metros text is attached! self.update = function () { metrosTextGraphics.text = 'Metros: ' + meters; }; }); // Create a MoneyText class var MoneyText = Container.expand(function () { var self = Container.call(this); // Attach a text asset to represent the money text var moneyTextGraphics = self.attachAsset('text', { anchorX: 0.5, anchorY: 0.5, text: 'Currency: 0', style: { fill: '#ffffff', fontSize: 50 } }); // This is automatically called every game tick, if the money text is attached! self.update = function () { moneyTextGraphics.text = 'Currency: ' + money; }; }); // Create a Player class var Player = Container.expand(function () { var self = Container.call(this); // Attach a shape asset to represent the player var playerGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); // Set player speed self.speed = 5; // This is automatically called every game tick, if the player is attached! self.update = function () { self.y += self.speed; // Add gravity to the player if (self.y < ground.y - self.height / 2 + 50) { self.speed += 0.5; } else { self.speed = 0; self.y = ground.y - self.height / 2 + 50; } // Add rotation to the player self.rotation += 0.05; // Play rockmovement sound in loop LK.getSound('rockmovement').play({ loop: true }); }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Create a background asset // Initialize a player asset var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Add the background to the game game.addChild(background); // Create a clone of the background asset var backgroundClone = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + background.width, y: 2732 / 2 }); // Add the clone to the game game.addChild(backgroundClone); // Create a second clone of the background asset var backgroundClone2 = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + 2 * background.width, y: 2732 / 2 }); // Add the second clone to the game game.addChild(backgroundClone2); // Initialize a ground asset var ground = LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, width: background.width, alpha: 0 }); // Add the ground to the game game.addChild(ground); // Create a player instance and add it to the game var player = game.addChild(new Player()); // Position player more towards the center of the screen player.x = 2048 / 4; player.y = 2732 / 2 + 10; // Initialize a variable to track 'meters' var meters = 0; // Initialize a variable to track 'giros' var giros = 0; // Create a MeterText instance and add it to the game var meterText = game.addChild(new MeterText()); // Position MeterText at the top left of the screen, a bit lower meterText.x = 50; meterText.y = 200; // Create a GirosText instance and add it to the game var girosText = game.addChild(new GirosText()); // Create a MetrosText instance and add it to the game var metrosText = game.addChild(new MetrosText()); // Position MetrosText below the GirosText metrosText.x = 50; metrosText.y = 400; // Create a currencyBox instance and add it to the game var currencyBox = game.addChild(new CurrencyBox()); var moneyText = game.addChild(new MoneyText()); // Position MoneyText on the currency box moneyText.x = currencyBox.x - currencyBox.width / 2; moneyText.y = currencyBox.y - currencyBox.height / 2; // The 'text' object has been removed from the game scene var money = 0; // Position GirosText below the MeterText, also a bit lower girosText.x = 50; girosText.y = 300; game.update = function () { background.x -= 5; backgroundClone.x -= 5; backgroundClone2.x -= 5; if (background.x + background.width < 0) { background.x = backgroundClone2.x + background.width; } if (backgroundClone.x + backgroundClone.width < 0) { backgroundClone.x = background.x + background.width; } if (backgroundClone2.x + backgroundClone2.width < 0) { backgroundClone2.x = backgroundClone.x + backgroundClone.width; } // Increment 'meters' every second if (LK.ticks % 60 == 0) { meters += 1; // Play the 'HoundreMeters' sound every 100 meters if (meters % 100 == 0) { LK.getSound('HoundreMeters').play(); } } // Increment 'giros' every 2.09 seconds if (LK.ticks % Math.round(2.09 * 60) == 0) { giros += 1; } };
===================================================================
--- original.js
+++ change.js
@@ -7,9 +7,9 @@
// Attach a currencyBox asset to represent the currencyBox
var currencyBoxGraphics = self.attachAsset('currencyBox', {
anchorX: 0.5,
anchorY: 0.5,
- x: 200,
+ x: 300,
y: 400,
width: 650,
height: 430
});
@@ -49,8 +49,26 @@
self.update = function () {
meterTextGraphics.text = 'Meters: ' + meters;
};
});
+// Create a MetrosText class
+var MetrosText = Container.expand(function () {
+ var self = Container.call(this);
+ // Attach a text asset to represent the metros text
+ var metrosTextGraphics = self.attachAsset('text', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ text: 'Metros: 0',
+ style: {
+ fill: '#ffffff',
+ fontSize: 50
+ }
+ });
+ // This is automatically called every game tick, if the metros text is attached!
+ self.update = function () {
+ metrosTextGraphics.text = 'Metros: ' + meters;
+ };
+});
// Create a MoneyText class
var MoneyText = Container.expand(function () {
var self = Container.call(this);
// Attach a text asset to represent the money text
@@ -161,8 +179,13 @@
meterText.x = 50;
meterText.y = 200;
// Create a GirosText instance and add it to the game
var girosText = game.addChild(new GirosText());
+// Create a MetrosText instance and add it to the game
+var metrosText = game.addChild(new MetrosText());
+// Position MetrosText below the GirosText
+metrosText.x = 50;
+metrosText.y = 400;
// Create a currencyBox instance and add it to the game
var currencyBox = game.addChild(new CurrencyBox());
var moneyText = game.addChild(new MoneyText());
// Position MoneyText on the currency box
que no contenga sombras ni luces
una cabeza de moai redonda. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una esfera de hierro. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una esfera de oro. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
una piedra redonda musgosa. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
la bandera de argentina redonda. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
moneda de cobre. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
moneda de silver. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
moneda de gold. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
diamante Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una rueda de carretilla medieval. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
pelota de basquetbal modelo Molten. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
pelota de futbol hecha de hielo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Bola disco. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una bola de voley de planta. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una bola de pinchos. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una bola de lana. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Agrega una esfera que dentro contenga un cielo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una esfera con la via láctea. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
proporción 1000-2000, marios más robustos y sin tanto relieve
Un papel medieval con una enorme flecha hacia la izquierda de pintura en medio. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Esfera del dragon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Esfera demoniaca. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Esfera de hada. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
una manzana redonda. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Un capiraba redondo como una pelota. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Un armadillo hecho bolita. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Una estrella redondita. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Mejorar el diseños de lás casas para que sean más medievales y aumentar su calidad, más arboles y mejorar la calidad del cesped