User prompt
Corrige el código
User prompt
El dinosaurio no tiene gravedad
User prompt
Mejora el juego y las texturas
User prompt
Haz que cuando tenga el dedo presionado en la pantalla el dinosaurio salte sin parar
User prompt
Elimina el SimpleObject y mejora el juego
User prompt
Mejora el juego
User prompt
Please fix the bug: 'Uncaught ReferenceError: dragNode is not defined' in or related to this line: 'if (dragNode) {' Line Number: 96
User prompt
Haz un juego similar a el dinosaurio de Chrome
User prompt
Haz que la cámara se mueva según con el toque del dedo
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'type')' in or related to this line: 'if (obj.event.type === 'touchstart') {' Line Number: 56
User prompt
Please fix the bug: 'Uncaught TypeError: simpleObject.containsPoint is not a function' in or related to this line: 'if (simpleObject.containsPoint(localPosition)) {' Line Number: 52
User prompt
Hazlo para teléfono
User prompt
Hazlo para teléfono
User prompt
Please fix the bug: 'Uncaught TypeError: simpleObject.containsPoint is not a function' in or related to this line: 'if (simpleObject.containsPoint(localPosition)) {' Line Number: 52
Initial prompt
Blender para teléfono
/**** * Classes ****/ var Dinosaur = Container.expand(function () { var self = Container.call(this); var dinosaurGraphics = self.attachAsset('dinosaur_image', { anchorX: 0.5, anchorY: 0.5 }); self.jumpSpeed = 0; self.isJumping = false; self.update = function () { if (self.isJumping) { self.y += self.jumpSpeed; self.jumpSpeed += 1; if (self.y >= 2732 / 2) { self.y = 2732 / 2; self.isJumping = false; } } else { // No gravity when the dinosaur is not jumping if (self.y > 2732 / 2) { self.y = 2732 / 2; } } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.jumpSpeed = -30; } }; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle_image', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -10; self.update = function () { self.x += self.speed; }; }); /**** * Initialize Game ****/ //<Write imports for supported plugins here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var dinosaur = game.addChild(new Dinosaur()); dinosaur.x = 2048 / 4; dinosaur.y = 2732 / 2; var obstacles = []; for (var i = 0; i < 5; i++) { var obstacle = game.addChild(new Obstacle()); obstacle.x = 2048 + i * 500; obstacle.y = 2732 / 2; obstacles.push(obstacle); } game.down = function (x, y, obj) { dinosaur.jump(); dragNode = dinosaur; }; game.move = function (x, y, obj) { if (dragNode) { dragNode.jump(); } }; //{new_code} game.up = function (x, y, obj) { dragNode = null; dinosaur.isJumping = false; }; //{new_code} var dragNode = null; game.update = function () { dinosaur.update(); for (var i = 0; i < obstacles.length; i++) { obstacles[i].update(); if (obstacles[i].x < -100) { obstacles[i].x = 2048 + Math.random() * 500; } if (dinosaur.intersects(obstacles[i])) { LK.showGameOver(); } } };
===================================================================
--- original.js
+++ change.js
@@ -17,10 +17,9 @@
self.y = 2732 / 2;
self.isJumping = false;
}
} else {
- // Add gravity when the dinosaur is not jumping
- self.y += 5;
+ // No gravity when the dinosaur is not jumping
if (self.y > 2732 / 2) {
self.y = 2732 / 2;
}
}