User prompt
Queso y lechuga deben ser arrojados a partes iguales con las mismas mecánicas que brocoli
User prompt
Agrega un nuevo tipo de proyectil llamado lechuga
User prompt
Truck debe estar siempre en el centro de la ruta
User prompt
La camioneta debe estar siempre en el centro de la ruta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
El coche debe seguir el recorrido de la ruta ahora se está saliendo de la carretera ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Los segmentos de la carretera se crean alto y luego bajan al horizonte, deben generarse directamente del horizonte
User prompt
Puedes implementar el sistema de curvas de los arcades tipo hang on ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Además de brocoli, deben arrojar un queso gruyere con la misma trayectoria, al momento de ser golpeado debe reproducir un asset que ponga queso
User prompt
Puedes eliminar las lineas blancas centrales
Code edit (2 edits merged)
Please save this source code
User prompt
Dirante el juego debe sonar gritos, el asset music alta.. debe sonar solo con el splash
Code edit (2 edits merged)
Please save this source code
User prompt
Cuando la moto esta muy cerca de uno de los bordes de la ruta es imposible esquivar los proyectiles porque van muy directos, podrias hacerlos mas facil de esquivar
User prompt
El numero de proyectiles debe ser mucho menor al comenzar, y la piedra debe ser menos frecuente hasta alcanzar los 500 mys e ir incrementando su frecuencia
User prompt
Debe haber por lo menos el triple de gente y objetos al costado de las rutas, peeo sin incrementar la cantidad de proyectiles que debe comenzar siendo pocos lanzamientos he ir incrementando gradualmente cada ve que se superen 500 mts
User prompt
La cancion alta debe sonar mientras se muestra el splash, mientras que altacoimera mientras se muestra carina, tambien es necesario que se escuche moto hasta que termine el juego
Code edit (2 edits merged)
Please save this source code
User prompt
Corrigelo
User prompt
La ultima ve que fumciono no estaba el splash, puedes revisar que piede ser?
User prompt
Siguen sin sonar, revisa uno por uno a ver si hay inconsistencias
User prompt
Puedes revisar porque no suenan ningún assets de sonido ni cancion
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Motorcycle = Container.expand(function () { var self = Container.call(this); var motorcycleGraphics = self.attachAsset('motorcycle', { anchorX: 0.5, anchorY: 0.5 }); self.health = 3; self.power = 100; self.speed = 0; self.maxSpeed = 3; self.x = 0; self.update = function () { if (gameStarted) { if (self.speed < self.maxSpeed) { var motoSound = LK.getSound('corruptosLoTuyos'); if (motoSound && typeof motoSound.play === 'function') { motoSound.play(); } self.speed += 0.02; } roadOffset += self.speed; } }; self.takeDamage = function (damageAmount) { damageAmount = damageAmount || 3; self.power = Math.max(0, self.power - damageAmount); LK.effects.flashObject(self, 0xff0000, 500); if (self.power <= 0) { LK.showGameOver(); } }; self.restorePower = function (amount) { amount = amount || 3; self.power = Math.min(100, self.power + amount); var powerSound = LK.getSound('power_up'); if (powerSound && typeof powerSound.play === 'function') { powerSound.play(); } }; return self; }); var PowerItem = Container.expand(function () { var self = Container.call(this); var itemGraphics = self.attachAsset('power_item', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.gravity = 0.15; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.velocityY += self.gravity; }; return self; }); var Projectile = Container.expand(function (isHeavy) { var self = Container.call(this); self.isHeavy = isHeavy || false; var assetName = self.isHeavy ? 'heavy_projectile' : 'projectile'; var projectileGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.gravity = 0; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.velocityY += self.gravity; self.rotation += 0.1; }; return self; }); var RoadsideObject = Container.expand(function (type) { var self = Container.call(this); self.objectType = type || 'person'; var objectGraphics = self.attachAsset(self.objectType, { anchorX: 0.5, anchorY: 1.0 }); self.throwTimer = 0; // lateral offset base by type (trees further from road than people) self.sideOffsetBase = 120; if (type === 'tree') { self.sideOffsetBase = 400; } if (type === 'sign') { self.sideOffsetBase = 160; } // Configurar delay de lanzamiento por tipo var baseMin = 800, baseRand = 240; if (type === 'person') { baseMin = 840; baseRand = 320; } if (type === 'person2') { baseMin = 720; baseRand = 280; } if (type === 'person3') { baseMin = 600; baseRand = 360; } self.throwDelay = Math.random() * baseRand + baseMin; self.isLeftSide = true; self.originalY = 0; self.hasThrownThisCycle = false; self.minThrowDistanceFromMotorcycleFactor = 0.6; self.update = function () { if (self.objectType === 'person' || self.objectType === 'person2' || self.objectType === 'person3') { self.throwTimer++; if (self.throwTimer >= self.throwDelay && gameStarted && !self.hasThrownThisCycle) { // lanzar solo cuando el objeto este en el rango vertical permitido y respetando cooldown global if (self.y >= throwMinY && self.y <= throwMaxY && LK.ticks - lastProjectileThrowTick >= minFramesBetweenProjectileThrows) { self.throwObject(); lastProjectileThrowTick = LK.ticks; self.hasThrownThisCycle = true; self.throwTimer = 0; // Recalcular segfn tipo var nMin = 400, nRand = 120; if (self.objectType === 'person') { nMin = 420; nRand = 160; } if (self.objectType === 'person2') { nMin = 360; nRand = 140; } if (self.objectType === 'person3') { nMin = 300; nRand = 180; } self.throwDelay = Math.random() * nRand + nMin; } } } if (gameStarted && motorcycle.speed > 0) { // Enhanced movement with better perspective scaling var distBefore = Math.max(0, roadY - self.y); var perspBefore = Math.max(0.01, Math.min(1, 1 - distBefore / horizonDistance)); var speedFactor = 1 + 2.5 * perspBefore; // Slightly increased speed factor self.y += motorcycle.speed * 3.2 * speedFactor; // Increased base movement speed // Calculate perspective with extended range for smoother transitions var currentDistance = roadY - self.y; var perspective = 1 - currentDistance / horizonDistance; // Allow objects to appear much earlier (when perspective is negative) and scale properly if (perspective > -2.0) { // Extended range for earlier appearance // Calculate road width with minimum constraint for stability var roadWidth = 2048 * Math.max(0.005, perspective); var sideOffset = self.sideOffsetBase * Math.max(0.005, perspective); // Position objects with extended side margins // Additional margin for better visibility if (self.isLeftSide) { self.x = 1024 - roadWidth / 2 - sideOffset; } else { self.x = 1024 + roadWidth / 2 + sideOffset; } // Enhanced scaling that allows very small objects in distance var finalScale = Math.max(0.0005, perspective); // Even smaller minimum scale if (finalScale < 0.01) { finalScale = 0.01; } // Prevent invisible objects self.scaleX = (self.isLeftSide ? -1 : 1) * finalScale; self.scaleY = finalScale; } if (gameStarted && (self.objectType === 'person' || self.objectType === 'person2' || self.objectType === 'person3') && !self.hasThrownThisCycle) { // chequeo continuo: solo lanzar en el rango vertical permitido y respetando cooldown global if (self.y >= throwMinY && self.y <= throwMaxY && LK.ticks - lastProjectileThrowTick >= minFramesBetweenProjectileThrows) { self.throwObject(); lastProjectileThrowTick = LK.ticks; self.hasThrownThisCycle = true; self.throwTimer = 0; var nMin2 = 400, nRand2 = 120; if (self.objectType === 'person') { nMin2 = 420; nRand2 = 160; } if (self.objectType === 'person2') { nMin2 = 360; nRand2 = 140; } if (self.objectType === 'person3') { nMin2 = 300; nRand2 = 180; } self.throwDelay = Math.random() * nRand2 + nMin2; } } // Reset when completely off screen with much larger margin if (self.y > roadY + 1600 || perspective < -2.0) { // Extended thresholds self.y = self.originalY; var resetDistance = roadY - self.originalY; var resetPerspective = Math.max(0.005, Math.min(1, 1 - resetDistance / horizonDistance)); var resetRoadWidth = 2048 * resetPerspective; var resetSideOffset = self.sideOffsetBase * resetPerspective; self.scaleX = (self.isLeftSide ? -1 : 1) * resetPerspective; self.scaleY = resetPerspective; if (self.isLeftSide) { self.x = 1024 - resetRoadWidth / 2 - resetSideOffset; } else { self.x = 1024 + resetRoadWidth / 2 + resetSideOffset; } self.hasThrownThisCycle = false; } } }; self.throwObject = function () { if (projectiles.length >= 3) { return; } var isHeavy = Math.random() < 0.15; var projectile = new Projectile(isHeavy); projectile.x = self.x; projectile.y = self.y - 20; var targetX = motorcycle.x + (Math.random() - 0.5) * 260; var horizontalFactor = isHeavy ? 0.009 : 0.008; projectile.velocityX = (targetX - projectile.x) * horizontalFactor; var initialUpImpulse = isHeavy ? -16 - Math.random() * 2 : -20 - Math.random() * 3; projectile.velocityY = initialUpImpulse; projectile.gravity = isHeavy ? 0.35 : 0.28; projectiles.push(projectile); game.addChild(projectile); var throwSound = LK.getSound('throw'); if (throwSound && typeof throwSound.play === 'function') { throwSound.play(); } }; return self; }); var Truck = Container.expand(function () { var self = Container.call(this); var truckGraphics = self.attachAsset('truck', { anchorX: 0.5, anchorY: 0.5 }); // karina indicator above the truck before dropping power item var karinaSprite = self.attachAsset('karina', { anchorX: 0.5, anchorY: 1.0 }); self.karinaBaseY = -450; self.karinaUpY = self.karinaBaseY - 30; karinaSprite.y = self.karinaBaseY; karinaSprite.scaleX = 3.0; karinaSprite.scaleY = 3.0; karinaSprite.visible = false; self.speed = -6; self.active = true; self.dropTimer = 0; self.dropDelay = 120; self.randomizeDropDelay = function () { var factor = 3 + Math.random() * 8; // 3x a 5x self.dropDelay = Math.floor(120 * factor); }; self.randomizeDropDelay(); self.targetY = horizonY + (roadY - horizonY) * 0.25; self.baseXFactorFromCenter = 0.42; self.oscAmp = 30; self.oscSpeed = 0.02; self.oscPhase = Math.random() * Math.PI * 2; self.karinaLead = 30; // frames before drop to show karina self.karinaAnimating = false; self.update = function () { if (self.active) { if (self.y > self.targetY) { self.y += self.speed; if (self.y <= self.targetY) { self.y = self.targetY; } } else { self.y = self.targetY; } var currentDistance = roadY - self.y; var perspective = Math.max(0.01, Math.min(1, 1 - currentDistance / (roadY - horizonY))); var roadWidthAtY = 2048 * perspective; var roadRightEdge = 1024 + roadWidthAtY / 2; var centerX = 1024; var targetBaseX = centerX + roadWidthAtY * self.baseXFactorFromCenter; self.oscPhase += self.oscSpeed; self.x = Math.min(roadRightEdge - 40 * perspective, targetBaseX + Math.sin(self.oscPhase) * self.oscAmp * perspective); var distanceToHorizon = roadY - horizonY; var currentDistance = roadY - self.y; var perspective = Math.max(0, 1 - currentDistance / distanceToHorizon); var centerX = 1024; self.scaleX = perspective; self.scaleY = perspective; if (gameStarted) { self.dropTimer++; if (!karinaSprite.visible && self.dropTimer >= self.dropDelay - self.karinaLead) { karinaSprite.visible = true; var s1 = LK.getSound('altacoimera'); if (s1 && typeof s1.play === 'function') { s1.play(); } if (!self.karinaAnimating) { self.karinaAnimating = true; var upDur = Math.max(6, Math.floor(self.karinaLead * 0.4)); var downDur = Math.max(6, self.karinaLead - upDur); tween(karinaSprite, { y: self.karinaUpY }, { duration: upDur, easing: tween.easeOut, onFinish: function onFinish() { tween(karinaSprite, { y: self.karinaBaseY }, { duration: downDur, easing: tween.easeIn, onFinish: function onFinish() { self.karinaAnimating = false; } }); } }); } } if (self.dropTimer >= self.dropDelay) { self.dropPowerItem(); self.dropTimer = 0; karinaSprite.visible = false; karinaSprite.y = self.karinaBaseY; self.karinaAnimating = false; self.randomizeDropDelay(); } } } }; self.dropPowerItem = function () { var powerItem = new PowerItem(); // Start from karina sprite position (global position within truck) var karinaWorldX = self.x + karinaSprite.x * self.scaleX; var karinaWorldY = self.y + karinaSprite.y * self.scaleY; powerItem.x = karinaWorldX; powerItem.y = karinaWorldY; // choose random point on the road (not targeting the motorcycle) var roadLeft = 200; var roadRight = 1848; var margin = 60; var targetX = roadLeft + margin + Math.random() * Math.max(0, roadRight - roadLeft - margin * 2); // Parabola estilo proyectiles laterales var horizontalFactor = 0.007; powerItem.velocityX = (targetX - powerItem.x) * horizontalFactor; var isHighArc = Math.random() < 0.4; powerItem.velocityY = isHighArc ? -10 - Math.random() * 3 : -8 - Math.random() * 2; powerItem.gravity = 0.28; powerItems.push(powerItem); game.addChild(powerItem); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ var roadY = 2732; // El horizonte debe estar en la parte superior del cesped // Cesped: y=2500, scaleY=3.45, height=500, anchorY=0.5 // Parte superior = y - (height * scaleY * anchorY) = 2500 - (500 * 3.45 * 0.5) = 2500 - 862.5 = 1637.5 var horizonY = 1638; var roadOffset = 0; var gameStarted = false; var phraseTimer = 0; var phraseInterval = 600; // 10 seconds at 60 FPS var phraseAssets = ['frase1', 'frase2', 'frase3', 'frase4', 'frase5', 'frase6']; // evitar repetir la misma frase consecutivamente var lastPhraseIndex = -1; var trucksCleared = false; var roadSegments = []; var roadLines = []; var leftSidewalks = []; var rightSidewalks = []; var totalSegments = 90; var horizonDistance = roadY - horizonY; var segmentSpacing = horizonDistance / totalSegments; var throwMinY = horizonY + horizonDistance * 0.35; var throwMaxY = horizonY + horizonDistance * 0.60; // cooldown global entre lanzamientos de proyectiles para espaciar var lastProjectileThrowTick = -10000; var minFramesBetweenProjectileThrows = 30; // Agregar margen inferior para evitar que la ruta se corte var bottomMargin = 400; var extendedRoadY = roadY + bottomMargin; LK.playMusic('alta'); game.addChild(LK.getAsset('cesped', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2500, scaleX: 5, scaleY: 3.45 })); game.addChild(LK.getAsset('skyline', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 739, scaleX: 21, scaleY: 18 })); for (var i = 0; i < totalSegments; i++) { var distance = i * segmentSpacing; var yPosition = roadY - distance; var perspective = 1 - distance / horizonDistance; var roadWidth = 2048 * perspective; var segmentHeight = segmentSpacing * 1.2 * perspective; if (yPosition >= horizonY) { if (i % 4 == 0) { var centerLine = game.addChild(LK.getAsset('road_line', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: yPosition, scaleX: perspective * 2, scaleY: perspective * 2 })); roadLines.push(centerLine); } var roadSeg = game.addChild(LK.getAsset('road_segment', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: yPosition, scaleX: roadWidth / 100, scaleY: segmentSpacing / 5 * perspective })); roadSegments.push(roadSeg); } } var powerBarBg = LK.getAsset('power_bar_bg', { anchorX: 0.5, anchorY: 1.0, x: 600, y: -300 }); LK.gui.center.addChild(powerBarBg); var powerBarFill = LK.getAsset('power_bar_fill', { anchorX: 0.5, anchorY: 1.0, x: 600, y: -300 }); LK.gui.center.addChild(powerBarFill); var powerItems = []; var roadsideObjects = []; var projectiles = []; // tipos base para objetos laterales var personVariants = ['person', 'person2', 'person3']; var otherVariants = ['tree', 'sign']; // cantidad por lado y distancia extendida para mayor espacio var objectsPerSide = 20; var extendedDistanceFactor = 6.4; // secuencias izquierda/derecha desfasadas para no coincidir al mismo tiempo var leftTypes = []; var rightTypes = []; for (var oi = 0; oi < objectsPerSide; oi++) { if (oi % 2 === 0) { leftTypes.push(personVariants[oi / 2 % personVariants.length | 0]); rightTypes.push(otherVariants[(oi / 2 + 1) % otherVariants.length | 0]); } else { leftTypes.push(otherVariants[(oi / 2 | 0) % otherVariants.length]); rightTypes.push(personVariants[(oi / 2 + 1) % personVariants.length | 0]); } } for (var i = 0; i < objectsPerSide; i++) { var leftType = leftTypes[i]; var leftObject = game.addChild(new RoadsideObject(leftType)); // mayor distancia y aparicion mas temprana var extendedDistance = horizonDistance * extendedDistanceFactor; var distance = i / objectsPerSide * extendedDistance; var yPos = extendedRoadY - distance; var perspective = 1 - Math.min(distance, horizonDistance) / horizonDistance; var roadWidth = 2048 * Math.max(0.005, perspective); // posicion izquierda leftObject.x = 1024 - roadWidth / 2 - 120 * Math.max(0.005, perspective); leftObject.y = yPos; leftObject.originalY = yPos; leftObject.scaleX = -Math.max(0.01, perspective); leftObject.scaleY = Math.max(0.01, perspective); leftObject.isLeftSide = true; roadsideObjects.push(leftObject); } for (var i = 0; i < objectsPerSide; i++) { var rightType = rightTypes[i]; var rightObject = game.addChild(new RoadsideObject(rightType)); // mayor distancia y escalon en Y para no coincidir con la izquierda var extendedDistance = horizonDistance * extendedDistanceFactor; var distance = (i + 0.5) / objectsPerSide * extendedDistance; var yPos = extendedRoadY - distance; var perspective = 1 - Math.min(distance, horizonDistance) / horizonDistance; var roadWidth = 2048 * Math.max(0.005, perspective); // posicion derecha rightObject.x = 1024 + roadWidth / 2 + 120 * Math.max(0.005, perspective); rightObject.y = yPos; rightObject.originalY = yPos; rightObject.scaleX = Math.max(0.01, perspective); rightObject.scaleY = Math.max(0.01, perspective); rightObject.isLeftSide = false; roadsideObjects.push(rightObject); } var scoreTxt = new Text2('Distancia: 0m', { size: 80, fill: 0x000000 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var healthTxt = new Text2('Power: 3', { size: 60, fill: 0xFF0000 }); healthTxt.anchor.set(0, 0); healthTxt.x = 0; healthTxt.y = 0; var motorcycle = game.addChild(new Motorcycle()); motorcycle.x = 800; motorcycle.y = roadY - 250; motorcycle.lastEdgeTick = -1000; LK.gui.topRight.addChild(healthTxt); var dragStartX = 0; var isDragging = false; // Splash setup var splash = LK.getAsset('splash', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1, scaleY: 1 }); var splashActive = true; LK.gui.center.addChild(splash); game.down = function (x, y, obj) { if (splashActive) { var clickSnd = LK.getSound('cloaca'); if (clickSnd && typeof clickSnd.play === 'function') { clickSnd.play(); } // dismiss splash and switch music LK.gui.center.removeChild(splash); splashActive = false; LK.stopMusic(); LK.setTimeout(function () { LK.playMusic('gritos'); LK.setTimeout(function () { LK.playMusic('moto'); }, 100); }, 100); if (trucksCleared) { gameStarted = true; } return; } if (gameStarted) { isDragging = true; dragStartX = x; } }; game.move = function (x, y, obj) { if (splashActive) { return; } var roadLeft = 200; var roadRight = 1848; var edgeCooldownTicks = 30; if (isDragging && gameStarted) { var deltaX = x - dragStartX; var newX = motorcycle.x + deltaX * 0.5; var hitEdge = false; if (newX < roadLeft) { newX = roadLeft; hitEdge = true; } if (newX > roadRight) { newX = roadRight; hitEdge = true; } if (newX !== motorcycle.x) { motorcycle.x = newX; } if (hitEdge && LK.ticks - motorcycle.lastEdgeTick > edgeCooldownTicks) { motorcycle.lastEdgeTick = LK.ticks; var edgeSnd = LK.getSound('edge'); if (edgeSnd && typeof edgeSnd.play === 'function') { edgeSnd.play(); } } dragStartX = x; } }; game.up = function (x, y, obj) { if (splashActive) { return; } isDragging = false; }; var trucks = []; var truck1 = game.addChild(new Truck()); truck1.x = 1024; truck1.y = roadY - 600; trucks.push(truck1); game.update = function () { if (!trucksCleared) { var allTrucksCleared = true; for (var i = 0; i < trucks.length; i++) { if (trucks[i].y > roadY - 300) { allTrucksCleared = false; break; } } if (allTrucksCleared) { trucksCleared = true; if (!splashActive) { gameStarted = true; } } } if (gameStarted && motorcycle.speed > 0) { var movementFactor = 3; var offset = roadOffset * movementFactor % horizonDistance; for (var i = 0; i < roadSegments.length; i++) { var distanceAlong = (i * segmentSpacing + offset) % horizonDistance; var yPosition = roadY - distanceAlong; var perspective = Math.max(0.01, Math.min(1.08, 1 - distanceAlong / horizonDistance)); var roadWidth = 2048 * perspective; roadSegments[i].y = yPosition; roadSegments[i].scaleX = roadWidth / 100; roadSegments[i].scaleY = horizonDistance / totalSegments / 5 * perspective; } var lineSpacing = segmentSpacing * 4; for (var j = 0; j < roadLines.length; j++) { var lineDistance = (j * lineSpacing + offset) % horizonDistance; var lineY = roadY - lineDistance; var linePerspective = Math.max(0.01, Math.min(1.08, 1 - lineDistance / horizonDistance)); roadLines[j].y = lineY; var lineCenterShift = typeof curveCenterShift !== 'undefined' ? curveCenterShift : 0; roadLines[j].x = 1024 + lineCenterShift; roadLines[j].scaleX = linePerspective * 3; roadLines[j].scaleY = linePerspective * 4; } for (var k = 0; k < leftSidewalks.length; k++) { var swDistance = (k * segmentSpacing + offset) % horizonDistance; var swY = roadY - swDistance; var swPerspective = Math.max(0.01, Math.min(1.08, 1 - swDistance / horizonDistance)); var swRoadWidth = 2048 * swPerspective; var segmentHeight = horizonDistance / totalSegments * 1.2 * swPerspective; leftSidewalks[k].y = swY; rightSidewalks[k].y = swY; leftSidewalks[k].x = 1024 - swRoadWidth / 2 - 80 * swPerspective; leftSidewalks[k].scaleX = swPerspective * 2; leftSidewalks[k].scaleY = segmentHeight / 40; rightSidewalks[k].x = 1024 + swRoadWidth / 2 + 80 * swPerspective; rightSidewalks[k].scaleX = swPerspective * 2; rightSidewalks[k].scaleY = segmentHeight / 40; } } if (gameStarted) { var distance = Math.floor(roadOffset / 10); scoreTxt.setText('Distancia de huida: ' + distance + 'm'); LK.setScore(distance); } healthTxt.setText('Power: ' + Math.round(motorcycle.power) + '%'); if (gameStarted) { if (motorcycle.lastX === undefined) { motorcycle.lastX = motorcycle.x; motorcycle.isFlipping = false; } var screenCenter = 1024; var crossedToRight = motorcycle.lastX < screenCenter && motorcycle.x >= screenCenter; var crossedToLeft = motorcycle.lastX > screenCenter && motorcycle.x <= screenCenter; if ((crossedToRight || crossedToLeft) && !motorcycle.isFlipping) { motorcycle.isFlipping = true; tween(motorcycle, { scaleX: -motorcycle.scaleX }, { duration: 0, easing: tween.easeOut, onFinish: function onFinish() { motorcycle.isFlipping = false; } }); } motorcycle.lastX = motorcycle.x; } var powerPercentage = motorcycle.power / 100; powerBarFill.scaleY = powerPercentage; if (powerPercentage > 0.6) { powerBarFill.tint = 0x99ff99; } else if (powerPercentage > 0.3) { powerBarFill.tint = 0xffff99; } else { powerBarFill.tint = 0xff9999; } for (var i = projectiles.length - 1; i >= 0; i--) { var projectile = projectiles[i]; if (projectile.x < -100 || projectile.x > 2148 || projectile.y > extendedRoadY + 100) { projectile.destroy(); projectiles.splice(i, 1); continue; } if (gameStarted && projectile.intersects(motorcycle)) { var damageAmount = projectile.isHeavy ? 20 : 3; motorcycle.takeDamage(damageAmount); var impactSnd = LK.getSound(projectile.isHeavy ? 'piedra' : 'hit'); if (impactSnd && typeof impactSnd.play === 'function') { impactSnd.play(); } projectile.destroy(); projectiles.splice(i, 1); continue; } if (projectile.y >= extendedRoadY - 20 && projectile.velocityY > 0) { projectile.destroy(); projectiles.splice(i, 1); } } for (var i = powerItems.length - 1; i >= 0; i--) { var powerItem = powerItems[i]; if (powerItem.x < -100 || powerItem.x > 2148 || powerItem.y > extendedRoadY + 100) { powerItem.destroy(); powerItems.splice(i, 1); continue; } if (gameStarted && powerItem.intersects(motorcycle)) { motorcycle.restorePower(3); powerItem.destroy(); powerItems.splice(i, 1); continue; } if (powerItem.y >= extendedRoadY - 20 && powerItem.velocityY > 0) { powerItem.destroy(); powerItems.splice(i, 1); } } // Random phrase system - play one of six phrases every 10 seconds if (gameStarted) { phraseTimer++; if (phraseTimer >= phraseInterval) { // seleccionar una frase diferente de la ultima var randomPhraseIndex = Math.floor(Math.random() * phraseAssets.length); if (phraseAssets.length > 1 && randomPhraseIndex === lastPhraseIndex) { // reintentar una vez para evitar repeticion inmediata randomPhraseIndex = (randomPhraseIndex + 1 + Math.floor(Math.random() * (phraseAssets.length - 1))) % phraseAssets.length; } var phraseSoundId = phraseAssets[randomPhraseIndex]; var phraseSound = LK.getSound(phraseSoundId); if (phraseSound && typeof phraseSound.play === 'function') { phraseSound.play(); } lastPhraseIndex = randomPhraseIndex; phraseTimer = 0; // reset timer } } if (gameStarted && LK.ticks % 600 == 0) { for (var j = 0; j < roadsideObjects.length; j++) { if (roadsideObjects[j].objectType === 'person' || roadsideObjects[j].objectType === 'person2' || roadsideObjects[j].objectType === 'person3') { var dec = 5; if (roadsideObjects[j].objectType === 'person3') { dec = 8; } if (roadsideObjects[j].objectType === 'person2') { dec = 6; } roadsideObjects[j].throwDelay = Math.max(20, roadsideObjects[j].throwDelay - dec); } } } };
===================================================================
--- original.js
+++ change.js
@@ -19,9 +19,12 @@
self.x = 0;
self.update = function () {
if (gameStarted) {
if (self.speed < self.maxSpeed) {
- LK.getSound('corruptosLoTuyos').play();
+ var motoSound = LK.getSound('corruptosLoTuyos');
+ if (motoSound && typeof motoSound.play === 'function') {
+ motoSound.play();
+ }
self.speed += 0.02;
}
roadOffset += self.speed;
}
@@ -36,9 +39,12 @@
};
self.restorePower = function (amount) {
amount = amount || 3;
self.power = Math.min(100, self.power + amount);
- LK.getSound('power_up').play();
+ var powerSound = LK.getSound('power_up');
+ if (powerSound && typeof powerSound.play === 'function') {
+ powerSound.play();
+ }
};
return self;
});
var PowerItem = Container.expand(function () {
@@ -229,9 +235,12 @@
projectile.velocityY = initialUpImpulse;
projectile.gravity = isHeavy ? 0.35 : 0.28;
projectiles.push(projectile);
game.addChild(projectile);
- LK.getSound('throw').play();
+ var throwSound = LK.getSound('throw');
+ if (throwSound && typeof throwSound.play === 'function') {
+ throwSound.play();
+ }
};
return self;
});
var Truck = Container.expand(function () {
@@ -395,10 +404,8 @@
// Agregar margen inferior para evitar que la ruta se corte
var bottomMargin = 400;
var extendedRoadY = roadY + bottomMargin;
LK.playMusic('alta');
-// LK.playMusic('gritos');
-// LK.playMusic('moto');
game.addChild(LK.getAsset('cesped', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
@@ -553,11 +560,15 @@
}
// dismiss splash and switch music
LK.gui.center.removeChild(splash);
splashActive = false;
- LK.stopMusic('alta');
- LK.playMusic('gritos');
- LK.playMusic('moto');
+ LK.stopMusic();
+ LK.setTimeout(function () {
+ LK.playMusic('gritos');
+ LK.setTimeout(function () {
+ LK.playMusic('moto');
+ }, 100);
+ }, 100);
if (trucksCleared) {
gameStarted = true;
}
return;
@@ -712,9 +723,11 @@
if (gameStarted && projectile.intersects(motorcycle)) {
var damageAmount = projectile.isHeavy ? 20 : 3;
motorcycle.takeDamage(damageAmount);
var impactSnd = LK.getSound(projectile.isHeavy ? 'piedra' : 'hit');
- if (impactSnd && typeof impactSnd.play === 'function') {}
+ if (impactSnd && typeof impactSnd.play === 'function') {
+ impactSnd.play();
+ }
projectile.destroy();
projectiles.splice(i, 1);
continue;
}
Un grupo de gente manifestando a cuerpo completo mirando al frente enojada con banderas argentinas, todo en pixel art. In-Game asset. 2d. High contrast. No shadows
Una planta de lechuga en pixel art en el aire. In-Game asset. 2d. High contrast. No shadows
Un queso gruyere en pixel art. In-Game asset. 2d. High contrast. No shadows
moto
Music
gritos
Music
noEsUnaHuida
Sound effect
frase2
Sound effect
frase3
Sound effect
frase6
Sound effect
edge
Sound effect
frase1
Sound effect
frase4
Sound effect
frase5
Sound effect
hit
Sound effect
power_up
Sound effect
throw
Sound effect
piedra
Sound effect
altacoimera
Sound effect
alta
Music
cloaca
Sound effect
corruptosLoTuyos
Sound effect
frase7
Sound effect
queso
Sound effect
espert
Sound effect
afuera
Sound effect
level_complete
Sound effect
pill_throw
Sound effect
diaper_drop
Sound effect
bridge_level
Sound effect
miraConan
Sound effect