User prompt
Agrega un texto arriba de los dados para que avisé cuando se puede lanzar y cuando están cambiando. También agrega un contador con segundos y decimales 1.00s (que se actualice a tiempo) al finalizar el cambio antes de poder lanzar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz que se tenga que esperar mínimo 1 segundos antes de hacer otro tiro
User prompt
Tiñe de un color amarillo suave los dados iguales y con colores random los dados iguales pero que son inferiores al grupo grande ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Agrega un texto en la parte superior centrado diciendo 0/8. El cero representa la cantidad de dados iguales (solo aplica el que mas se repita. Ej: si hay 2 dados de 4 y 4 dados de 1 solo contará el grupo más grande)
User prompt
El sonido no se escucha, haz que la lógica de sonido este por separado
User prompt
Agrega un sonido cada que los dados cambian
User prompt
Haz que suene roll cada que los dados se tiran (haz que se escuche un máximo de 4 roll sound para evitar sonidos fuertes)
User prompt
Agrega un efecto de rebote cada vez que cabía ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Arregla el error que hace que el asset de dado desaparezca por momentos, haz que el cambio entre asset no se vea con lagasos (no tweet plugin)
User prompt
Arregla el error que hace que el asset de dado desaparezca por momentos, haz que el cambio entre asset no se vea con lagasos (no tweet plugin)
User prompt
Arregla el error que hace que el asset de dado desaparezca por momentos, haz que el cambio entre asset no se vea con lagasos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Arregla el error que hace que no cambie los asset con los valores
User prompt
Haz que el objeto no se borre y cree otro, que simplemente cambie asset
User prompt
Agrega un evento llamado "lanzamiento" con un activador bolano. Haz que cada dado cambie aleatoriamente entre 6 a 12 veces empezando rápido y terminando cada vez más lento hasta finalizar. Una vez el último dado para se puede volver a tirar (sin tweet plugin, ni comentarios)
User prompt
Sin tweet plugin
User prompt
Agrega un evento llamado "lanzamiento" con un activador bolano. Haz que cada dado cambie aleatoriamente entre 6 a 12 veces empezando rápido y terminando cada vez más lento hasta finalizar. Una vez el último dado para se puede volver a tirar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Quiero que al tocar la pantalla los números cambien aleatoriamente
Code edit (1 edits merged)
Please save this source code
User prompt
Asigna un asset diferente para cada valor del dado
User prompt
Agrega a cada dado una varisble numérica llamada "valor"
User prompt
Agrega una variable Number a cada dado
User prompt
Agrega una variable number a cada dado, haz que cada segundo de la animación roll su variable cambie aleatorio en un rango entre 1 a 6, haz que su aset cambie durante la animación correspondiente la variable con el número del dado ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Agrega una flag para permitir el rodamiento una vez finaliza la animación y pasa un segundo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Agrega una animación al tocar la pantalla donde los dados dan 3 giros en su propio eje ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Dice = Container.expand(function () { var self = Container.call(this); var diceGraphics = self.attachAsset('Dice', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ // Create array to hold all dice var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Create array to hold all dice var diceArray = []; // Flag to control if dice can be rolled var canRoll = true; // Calculate center positions for two columns var centerX = 2048 / 2; var centerY = 2732 / 2; var columnSpacing = 330; // Space between columns var rowSpacing = 300; // Space between rows // Create 8 dice in two columns (4 rows each) for (var col = 0; col < 2; col++) { for (var row = 0; row < 4; row++) { var dice = new Dice(); // Position dice in grid dice.x = centerX + (col - 0.5) * columnSpacing; dice.y = centerY + (row - 1.5) * rowSpacing; // Add to game and array game.addChild(dice); diceArray.push(dice); } // Add screen tap event to trigger dice rolling animation game.down = function (x, y, obj) { // Only roll if allowed if (!canRoll) return; // Set rolling flag to prevent multiple rolls canRoll = false; // Animate all dice with 3 full rotations (6π radians) for (var i = 0; i < diceArray.length; i++) { var dice = diceArray[i]; // Reset rotation to 0 before starting animation dice.rotation = 0; // Animate to 3 full rotations (3 * 2π = 6π radians) tween(dice, { rotation: Math.PI * 6 }, { duration: 3000, easing: tween.easeOut, onFinish: function onFinish() { // After animation completes, wait 1 second before allowing next roll LK.setTimeout(function () { canRoll = true; }, 1000); } }); } }; }
===================================================================
--- original.js
+++ change.js
@@ -27,8 +27,10 @@
* Game Code
****/
// Create array to hold all dice
var diceArray = [];
+// Flag to control if dice can be rolled
+var canRoll = true;
// Calculate center positions for two columns
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var columnSpacing = 330; // Space between columns
@@ -45,8 +47,12 @@
diceArray.push(dice);
}
// Add screen tap event to trigger dice rolling animation
game.down = function (x, y, obj) {
+ // Only roll if allowed
+ if (!canRoll) return;
+ // Set rolling flag to prevent multiple rolls
+ canRoll = false;
// Animate all dice with 3 full rotations (6π radians)
for (var i = 0; i < diceArray.length; i++) {
var dice = diceArray[i];
// Reset rotation to 0 before starting animation
@@ -55,9 +61,15 @@
tween(dice, {
rotation: Math.PI * 6
}, {
duration: 3000,
- easing: tween.easeOut
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ // After animation completes, wait 1 second before allowing next roll
+ LK.setTimeout(function () {
+ canRoll = true;
+ }, 1000);
+ }
});
}
};
}
\ No newline at end of file