/****
* Classes
****/
var Coin = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
self.x -= self.speed;
if (self.x < -50) {
self.destroy();
}
};
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.x -= self.speed;
if (self.x < -50) {
self.destroy();
}
};
return self;
});
var Platform = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
}).alpha = 0.5;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.jumpHeight = 40;
self.isJumping = false;
self.velocityY = 0;
self.coinCount = 0;
self.hasJokerImmunity = false;
self.useJoker = function () {
if (self.hasJokerImmunity) {
self.hasJokerImmunity = false;
jokerIcon.visible = false;
}
};
self.update = function () {
if (self.isJumping) {
self.y += self.velocityY;
self.velocityY += 0.7;
if (self.y >= 2732 / 2) {
self.y = 2732 / 2;
self.isJumping = false;
self.velocityY = 0;
}
}
};
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.velocityY = -self.jumpHeight;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xADD8E6
});
/****
* Game Code
****/
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) {
return _arrayLikeToArray(r, a);
}
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) {
return Array.from(r);
}
}
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) {
return _arrayLikeToArray(r);
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) {
n[e] = r[e];
}
return n;
}
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0
}));
background.x = 0;
background.y = 0;
var platforms = [];
for (var i = 1; i < 7; i++) {
var platform = new Platform();
platform.x = 2048 / 2;
platform.y = 2732 / 7 * i;
platforms.push(platform);
game.addChild(platform);
}
var player = game.addChild(new Player());
player.currentPlatform = platforms[5];
player.y = player.currentPlatform.y - player.height + 100;
player.x = 250;
var enemies = [];
var coins = [];
var jokers = [];
var coinCount = 0;
var enemySpawnCounter = 0;
var enemySpawnInterval = 100;
var scoreText = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
LK.gui.top.addChild(scoreText);
scoreText.x = 2048 / 2;
scoreText.y = 0;
var coinText = new Text2('Coins: 0', {
size: 80,
fill: 0xFFFF00
});
LK.gui.bottom.addChild(coinText);
coinText.x = 2048 / 2;
coinText.y = 2732 - coinText.height;
LK.playMusic('music');
LK.playMusic('music2');
function spawnCoinOnPlatform(platform) {
var coin = new Coin();
coin.x = 2048;
coin.y = platform.y - 150;
game.addChild(coin);
coins.push(coin);
}
function updatePlayer() {
player.speed += 2;
player.jumpHeight += 10;
}
game.update = function () {
player.update();
if (LK.ticks % 3600 === 0 && LK.ticks <= 18000) {
// Increase speed every minute until the 5th minute
coins.forEach(function (c) {
c.speed += 0.6;
});
enemies.forEach(function (e) {
e.speed += 0.6;
});
}
enemySpawnCounter++;
if (enemySpawnCounter >= enemySpawnInterval && enemies.length === 0) {
var usedPlatforms = [];
var platformCount = LK.ticks < 900 ? 3 : LK.ticks < 2700 ? 4 : 5;
for (var i = 0; i < platformCount; i++) {
var enemy = new Enemy();
enemy.x = 2048;
var idx;
do {
idx = Math.floor(Math.random() * platforms.length);
} while (usedPlatforms.includes(idx));
usedPlatforms.push(idx);
enemy.y = platforms[idx].y - enemy.height + 50;
enemies.push(enemy);
game.addChild(enemy);
}
enemySpawnInterval = Math.floor(Math.random() * 200) + 50;
enemySpawnCounter = 0;
var coinPlatforms = Array.from(Array(6).keys()).filter(function (i) {
return !usedPlatforms.includes(i);
});
if (coinPlatforms.length > 0) {
var coinIndex = coinPlatforms[Math.floor(Math.random() * coinPlatforms.length)];
spawnCoinOnPlatform(platforms[coinIndex]);
}
}
enemies = enemies.filter(function (e) {
e.update();
if (player.intersects(e)) {
if (player.hasJokerImmunity) {
player.useJoker();
} else if (player.lives > 1) {
player.lives -= 1; // Decrease player's life
} else {
LK.getSound('enemySound').play();
LK.setTimeout(function () {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}, 500);
}
} else if (player.x > e.x && !e.passed) {
e.passed = true;
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
}
if (e.x < -50) {
game.removeChild(e);
return false;
}
return true;
});
coins = coins.filter(function (c) {
if (player.intersects(c)) {
game.removeChild(c);
coinCount += 5;
coinText.setText('Coins: ' + coinCount);
LK.setScore(LK.getScore() + 5);
scoreText.setText('Best Score: ' + LK.getScore());
LK.getSound('coinSound').play();
if (coinCount >= 10) {
updatePlayer();
}
return false;
}
return true;
});
};
game.down = function (x, y, obj) {
var idx = platforms.indexOf(player.currentPlatform);
player.currentPlatform = idx === 5 ? platforms[0] : platforms[idx + 1];
player.y = player.currentPlatform.y - player.height + 100;
}; /****
* Classes
****/
var Coin = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
self.x -= self.speed;
if (self.x < -50) {
self.destroy();
}
};
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.x -= self.speed;
if (self.x < -50) {
self.destroy();
}
};
return self;
});
var Platform = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
}).alpha = 0.5;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.jumpHeight = 40;
self.isJumping = false;
self.velocityY = 0;
self.coinCount = 0;
self.hasJokerImmunity = false;
self.useJoker = function () {
if (self.hasJokerImmunity) {
self.hasJokerImmunity = false;
jokerIcon.visible = false;
}
};
self.update = function () {
if (self.isJumping) {
self.y += self.velocityY;
self.velocityY += 0.7;
if (self.y >= 2732 / 2) {
self.y = 2732 / 2;
self.isJumping = false;
self.velocityY = 0;
}
}
};
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.velocityY = -self.jumpHeight;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xADD8E6
});
/****
* Game Code
****/
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) {
return _arrayLikeToArray(r, a);
}
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) {
return Array.from(r);
}
}
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) {
return _arrayLikeToArray(r);
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) {
n[e] = r[e];
}
return n;
}
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0
}));
background.x = 0;
background.y = 0;
var platforms = [];
for (var i = 1; i < 7; i++) {
var platform = new Platform();
platform.x = 2048 / 2;
platform.y = 2732 / 7 * i;
platforms.push(platform);
game.addChild(platform);
}
var player = game.addChild(new Player());
player.currentPlatform = platforms[5];
player.y = player.currentPlatform.y - player.height + 100;
player.x = 250;
var enemies = [];
var coins = [];
var jokers = [];
var coinCount = 0;
var enemySpawnCounter = 0;
var enemySpawnInterval = 100;
var scoreText = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
LK.gui.top.addChild(scoreText);
scoreText.x = 2048 / 2;
scoreText.y = 0;
var coinText = new Text2('Coins: 0', {
size: 80,
fill: 0xFFFF00
});
LK.gui.bottom.addChild(coinText);
coinText.x = 2048 / 2;
coinText.y = 2732 - coinText.height;
LK.playMusic('music');
LK.playMusic('music2');
function spawnCoinOnPlatform(platform) {
var coin = new Coin();
coin.x = 2048;
coin.y = platform.y - 150;
game.addChild(coin);
coins.push(coin);
}
function updatePlayer() {
player.speed += 2;
player.jumpHeight += 10;
}
game.update = function () {
player.update();
if (LK.ticks % 3600 === 0 && LK.ticks <= 18000) {
// Increase speed every minute until the 5th minute
coins.forEach(function (c) {
c.speed += 0.6;
});
enemies.forEach(function (e) {
e.speed += 0.6;
});
}
enemySpawnCounter++;
if (enemySpawnCounter >= enemySpawnInterval && enemies.length === 0) {
var usedPlatforms = [];
var platformCount = LK.ticks < 900 ? 3 : LK.ticks < 2700 ? 4 : 5;
for (var i = 0; i < platformCount; i++) {
var enemy = new Enemy();
enemy.x = 2048;
var idx;
do {
idx = Math.floor(Math.random() * platforms.length);
} while (usedPlatforms.includes(idx));
usedPlatforms.push(idx);
enemy.y = platforms[idx].y - enemy.height + 50;
enemies.push(enemy);
game.addChild(enemy);
}
enemySpawnInterval = Math.floor(Math.random() * 200) + 50;
enemySpawnCounter = 0;
var coinPlatforms = Array.from(Array(6).keys()).filter(function (i) {
return !usedPlatforms.includes(i);
});
if (coinPlatforms.length > 0) {
var coinIndex = coinPlatforms[Math.floor(Math.random() * coinPlatforms.length)];
spawnCoinOnPlatform(platforms[coinIndex]);
}
}
enemies = enemies.filter(function (e) {
e.update();
if (player.intersects(e)) {
if (player.hasJokerImmunity) {
player.useJoker();
} else if (player.lives > 1) {
player.lives -= 1; // Decrease player's life
} else {
LK.getSound('enemySound').play();
LK.setTimeout(function () {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}, 500);
}
} else if (player.x > e.x && !e.passed) {
e.passed = true;
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
}
if (e.x < -50) {
game.removeChild(e);
return false;
}
return true;
});
coins = coins.filter(function (c) {
if (player.intersects(c)) {
game.removeChild(c);
coinCount += 5;
coinText.setText('Coins: ' + coinCount);
LK.setScore(LK.getScore() + 5);
scoreText.setText('Best Score: ' + LK.getScore());
LK.getSound('coinSound').play();
if (coinCount >= 10) {
updatePlayer();
}
return false;
}
return true;
});
};
game.down = function (x, y, obj) {
var idx = platforms.indexOf(player.currentPlatform);
player.currentPlatform = idx === 5 ? platforms[0] : platforms[idx + 1];
player.y = player.currentPlatform.y - player.height + 100;
};
korkunç kuş canavarı. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
gökyüzü kahramanı. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
sade gökyüzü
düz kırmızı kalp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows