User prompt
engeller 20 saniyeden sonra 6 tane gelsin ve gittikçe bu sayı çoğalsın ve engelerin hızı artsın
User prompt
engeller random olarak gelsin
User prompt
engeller 10 saniyeden sonra gitttikçe çoğalsın ama hiç bir zaman tüm ekranı kaplamasın
User prompt
karekterim her zaman ortada başlasın
User prompt
10 saniyeden sonra biraz daha hızlansın engeller
User prompt
30 saniyeden sonra engeller daha fazla hızlansın
User prompt
40 saniyeden sonra engeller 6 tanesi birden gelmeye başlasın
User prompt
engeller 30 saniyeden sonra dört engel birden gelmeye başlasın
User prompt
engeller zaman geçtikce yavaşca hızlansın
User prompt
engelleri her geçtiğimizde artı bir versin
User prompt
ne kadar scor yaptığımız yazsın
User prompt
ne kadar çok coin geçersek svorumuz o kadar olsun
User prompt
rakipler eski hızına ddönsün
User prompt
rakipler 100 25 hızda olsun
User prompt
rakipler 100 60 hızlı olsun
User prompt
rakipler gittikçe hızlansın
User prompt
arka plan mavi olsun
Initial prompt
subrayw surf
/**** * Classes ****/ // Coin class var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Coin update logic }; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -5; self.update = function () { self.y += self.speed; }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Player update logic }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize player var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 200; // Arrays to hold obstacles and coins var obstacles = []; var coins = []; // Score display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Game update function game.update = function () { // Update player player.update(); // Update obstacles for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].update(); if (obstacles[i].y < -50) { obstacles[i].destroy(); obstacles.splice(i, 1); } if (player.intersects(obstacles[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } // Update coins for (var j = coins.length - 1; j >= 0; j--) { coins[j].update(); if (coins[j].y < -50) { coins[j].destroy(); coins.splice(j, 1); } if (player.intersects(coins[j])) { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); coins[j].destroy(); coins.splice(j, 1); } } // Spawn obstacles if (LK.ticks % 60 == 0) { var newObstacle = new Obstacle(); newObstacle.x = Math.random() * 2048; newObstacle.y = 2732; obstacles.push(newObstacle); game.addChild(newObstacle); } // Spawn coins if (LK.ticks % 120 == 0) { var newCoin = new Coin(); newCoin.x = Math.random() * 2048; newCoin.y = 2732; coins.push(newCoin); game.addChild(newCoin); } }; // Handle player movement game.down = function (x, y, obj) { player.x = x; player.y = y; }; game.move = function (x, y, obj) { player.x = x; player.y = y; }; game.up = function (x, y, obj) { // Stop player movement };
/****
* Classes
****/
// Coin class
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Coin update logic
};
});
// Obstacle class
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -5;
self.update = function () {
self.y += self.speed;
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
// Player update logic
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize player
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
// Arrays to hold obstacles and coins
var obstacles = [];
var coins = [];
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Game update function
game.update = function () {
// Update player
player.update();
// Update obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].update();
if (obstacles[i].y < -50) {
obstacles[i].destroy();
obstacles.splice(i, 1);
}
if (player.intersects(obstacles[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
// Update coins
for (var j = coins.length - 1; j >= 0; j--) {
coins[j].update();
if (coins[j].y < -50) {
coins[j].destroy();
coins.splice(j, 1);
}
if (player.intersects(coins[j])) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
coins[j].destroy();
coins.splice(j, 1);
}
}
// Spawn obstacles
if (LK.ticks % 60 == 0) {
var newObstacle = new Obstacle();
newObstacle.x = Math.random() * 2048;
newObstacle.y = 2732;
obstacles.push(newObstacle);
game.addChild(newObstacle);
}
// Spawn coins
if (LK.ticks % 120 == 0) {
var newCoin = new Coin();
newCoin.x = Math.random() * 2048;
newCoin.y = 2732;
coins.push(newCoin);
game.addChild(newCoin);
}
};
// Handle player movement
game.down = function (x, y, obj) {
player.x = x;
player.y = y;
};
game.move = function (x, y, obj) {
player.x = x;
player.y = y;
};
game.up = function (x, y, obj) {
// Stop player movement
};