User prompt
Kaktüsler bazen yan yana 2 tane doğabilir, kuşlar ve kaktüsler rastgele zamanlarda rastgele sıklıkta gelir
User prompt
Kuşlar skor 100'ün altındaysa spawn olmaz
User prompt
Kuşlar, skor 100'ü geçtikten sonra nadiren gelmeye başlar
User prompt
Kuşlar sadece skor 100'ü geçtikten sonra gelmeye başlar
User prompt
Trexin zıplama mekaniğini düzelt
User prompt
Trex, zıpladıktan sonra ilk konumuna düşer.
User prompt
Trex'in ilk, zıplamasında hata var
User prompt
İlk tıklamada trex yarım zıplıyor bu bir hata bunu düzelt
User prompt
Trex zıpladıktan sonra başta bulunduğu konuma düşer
User prompt
Trex zıplarken aynı konumuna düşer
User prompt
Kuş daha yüksekte doğar
User prompt
Trex daha fazla zıplar
User prompt
Yerçekimi etkisini arttır
User prompt
Trex zıpladıktan sonra aynı konumuna düşsün
User prompt
Trex zıplarken tekrar başta olduğu yere insin
User prompt
Semin rengini çöl yap
User prompt
Zeminin rengi çöl rengine benzesin
User prompt
Zemin ekle
User prompt
Trex aynı yere zıplasın
User prompt
Engelleri büyüt
User prompt
Çok az daha
User prompt
Trexi çok az inidr
User prompt
Trexi biraz yukarı kaldır
User prompt
Trexi yukarı kaldır
User prompt
Trex daha fazla zıplasın
/**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -40; self.update = function () { self.x += self.speed; }; }); var Cactus = Container.expand(function () { var self = Container.call(this); var cactusGraphics = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -40; self.update = function () { self.x += self.speed; }; }); var Dino = Container.expand(function () { var self = Container.call(this); var dinoGraphics = self.attachAsset('dino', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.speed = 0; self.gravity = 2; self.jumpStrength = -50; self.isJumping = false; self.update = function () { if (self.isJumping) { self.speed += self.gravity; self.y += self.speed; if (self.y > 2732 - dinoGraphics.height) { self.y = 2732 - dinoGraphics.height; self.speed = 0; self.isJumping = false; } } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.speed = self.jumpStrength; } }; }); var DoubleCactus = Container.expand(function () { var self = Container.call(this); var cactusGraphics1 = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 0.5 }); var cactusGraphics2 = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 0.5, x: cactusGraphics1.width }); self.speed = -40; self.update = function () { self.x += self.speed; }; }); /**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Dino class representing the player character var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var dino = game.addChild(new Dino()); dino.x = 400; // Move the Dino character to the right dino.y = 2732 - dino.height + 100; var obstacles = []; game.update = function () { if (LK.ticks % Math.floor(Math.random() * 120) == 0) { var obstacle; var obstacleType = Math.random(); if (obstacleType < 0.33 || LK.getScore() < 100) { obstacle = new Cactus(); obstacle.y = 2732 - obstacle.height; } else if (obstacleType < 0.66) { obstacle = new Bird(); obstacle.y = 2732 - obstacle.height - 400; } else { obstacle = new DoubleCactus(); obstacle.y = 2732 - obstacle.height; } obstacle.x = 2048; obstacles.push(obstacle); game.addChild(obstacle); } for (var i = obstacles.length - 1; i >= 0; i--) { if (obstacles[i].x < -obstacles[i].width) { obstacles[i].destroy(); obstacles.splice(i, 1); } else if (dino.intersects(obstacles[i])) { LK.showGameOver(); } } if (LK.ticks % 7 == 0) { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); } }; var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); game.down = function (x, y, obj) { dino.jump(); };
===================================================================
--- original.js
+++ change.js
@@ -52,8 +52,24 @@
self.speed = self.jumpStrength;
}
};
});
+var DoubleCactus = Container.expand(function () {
+ var self = Container.call(this);
+ var cactusGraphics1 = self.attachAsset('cactus', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var cactusGraphics2 = self.attachAsset('cactus', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: cactusGraphics1.width
+ });
+ self.speed = -40;
+ self.update = function () {
+ self.x += self.speed;
+ };
+});
/****
* Initialize Game
****/
@@ -71,16 +87,20 @@
dino.x = 400; // Move the Dino character to the right
dino.y = 2732 - dino.height + 100;
var obstacles = [];
game.update = function () {
- if (LK.ticks % 120 == 0) {
+ if (LK.ticks % Math.floor(Math.random() * 120) == 0) {
var obstacle;
- if (Math.random() < 0.5 || LK.getScore() < 100) {
+ var obstacleType = Math.random();
+ if (obstacleType < 0.33 || LK.getScore() < 100) {
obstacle = new Cactus();
obstacle.y = 2732 - obstacle.height;
- } else {
+ } else if (obstacleType < 0.66) {
obstacle = new Bird();
obstacle.y = 2732 - obstacle.height - 400;
+ } else {
+ obstacle = new DoubleCactus();
+ obstacle.y = 2732 - obstacle.height;
}
obstacle.x = 2048;
obstacles.push(obstacle);
game.addChild(obstacle);