/**** 
* Classes
****/ 
// The assets will be automatically created and loaded by the LK engine
// Bird class
var Bird = Container.expand(function () {
	var self = Container.call(this);
	var birdGraphics = self.attachAsset('bird', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 1;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
		}
	};
});
// Boss class
var Boss = Container.expand(function () {
	var self = Container.call(this);
	var bossGraphics = self.attachAsset('boss', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 1;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.showGameOver();
		}
	};
});
// Bubble class
var Bubble = Container.expand(function () {
	var self = Container.call(this);
	var bubbleGraphics = self.attachAsset('bubble', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 20;
	self.update = function () {
		self.x += self.speed;
		if (self.x > 2048) {
			self.destroy();
		}
		if (self.intersects(boss)) {
			boss.destroy();
			self.destroy();
			LK.setScore(LK.getScore() + 10);
			scoreTxt.setText(LK.getScore());
		}
		if (self.intersects(enemy)) {
			enemy.destroy();
			self.destroy();
			LK.setScore(LK.getScore() + 10);
			scoreTxt.setText(LK.getScore());
		}
	};
});
// Button class
var Button = Container.expand(function () {
	var self = Container.call(this);
	var buttonGraphics = self.attachAsset('button', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.down = function (x, y, obj) {
		var bubble = game.addChild(new Bubble());
		bubble.x = bird.x;
		bubble.y = bird.y;
	};
});
// Cloud class
var Cloud = Container.expand(function () {
	var self = Container.call(this);
	var appleGraphics = self.attachAsset('apple', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.setScore(LK.getScore() + 1);
			scoreTxt.setText(LK.getScore());
			self.y = 2732 + Math.random() * 500; // Increase the y position randomly between 2732 and 3232
			self.x = Math.random() * 2048;
		}
	};
});
// Enemy class
var Enemy = Container.expand(function () {
	var self = Container.call(this);
	var enemyGraphics = self.attachAsset('enemy', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.showGameOver();
		}
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x87CEEB // Sky blue background
});
/**** 
* Game Code
****/ 
var bird = game.addChild(new Bird());
bird.x = 2048 / 2;
bird.y = 2732 / 2;
var clouds = [];
for (var i = 0; i < 10; i++) {
	var cloud = game.addChild(new Cloud());
	cloud.x = Math.random() * 2048;
	cloud.y = Math.random() * 2732;
	clouds.push(cloud);
}
var scoreTxt = new Text2('0', {
	size: 150,
	fill: "#ffffff"
});
var enemy = game.addChild(new Enemy());
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 2732;
var button = game.addChild(new Button());
button.x = 2048 / 2;
button.y = 2732 - 150;
LK.gui.top.addChild(scoreTxt);
game.down = function (x, y, obj) {
	bird.y -= 100;
	if (x < bird.x) {
		bird.x -= 100;
	} else if (x > bird.x) {
		bird.x += 100;
	}
};
var boss;
game.update = function () {
	if (bird.y > 2732) {
		LK.showGameOver();
	}
	if (LK.getScore() == 10 && !boss) {
		boss = game.addChild(new Boss());
		boss.x = 2048 / 2;
		boss.y = 0;
	}
	// Create more enemies when score reaches 20, 30, 40 and so on
	if (LK.getScore() % 10 == 0 && LK.getScore() != 0) {
		var enemy = game.addChild(new Enemy());
		enemy.x = Math.random() * 2048;
		enemy.y = Math.random() * 2732;
	}
}; /**** 
* Classes
****/ 
// The assets will be automatically created and loaded by the LK engine
// Bird class
var Bird = Container.expand(function () {
	var self = Container.call(this);
	var birdGraphics = self.attachAsset('bird', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 1;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
		}
	};
});
// Boss class
var Boss = Container.expand(function () {
	var self = Container.call(this);
	var bossGraphics = self.attachAsset('boss', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 1;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.showGameOver();
		}
	};
});
// Bubble class
var Bubble = Container.expand(function () {
	var self = Container.call(this);
	var bubbleGraphics = self.attachAsset('bubble', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 20;
	self.update = function () {
		self.x += self.speed;
		if (self.x > 2048) {
			self.destroy();
		}
		if (self.intersects(boss)) {
			boss.destroy();
			self.destroy();
			LK.setScore(LK.getScore() + 10);
			scoreTxt.setText(LK.getScore());
		}
		if (self.intersects(enemy)) {
			enemy.destroy();
			self.destroy();
			LK.setScore(LK.getScore() + 10);
			scoreTxt.setText(LK.getScore());
		}
	};
});
// Button class
var Button = Container.expand(function () {
	var self = Container.call(this);
	var buttonGraphics = self.attachAsset('button', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.down = function (x, y, obj) {
		var bubble = game.addChild(new Bubble());
		bubble.x = bird.x;
		bubble.y = bird.y;
	};
});
// Cloud class
var Cloud = Container.expand(function () {
	var self = Container.call(this);
	var appleGraphics = self.attachAsset('apple', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.setScore(LK.getScore() + 1);
			scoreTxt.setText(LK.getScore());
			self.y = 2732 + Math.random() * 500; // Increase the y position randomly between 2732 and 3232
			self.x = Math.random() * 2048;
		}
	};
});
// Enemy class
var Enemy = Container.expand(function () {
	var self = Container.call(this);
	var enemyGraphics = self.attachAsset('enemy', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		self.y -= self.speed;
		if (self.y < 0) {
			self.y = 2732;
			self.x = Math.random() * 2048;
		}
		if (self.intersects(bird)) {
			LK.showGameOver();
		}
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x87CEEB // Sky blue background
});
/**** 
* Game Code
****/ 
var bird = game.addChild(new Bird());
bird.x = 2048 / 2;
bird.y = 2732 / 2;
var clouds = [];
for (var i = 0; i < 10; i++) {
	var cloud = game.addChild(new Cloud());
	cloud.x = Math.random() * 2048;
	cloud.y = Math.random() * 2732;
	clouds.push(cloud);
}
var scoreTxt = new Text2('0', {
	size: 150,
	fill: "#ffffff"
});
var enemy = game.addChild(new Enemy());
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 2732;
var button = game.addChild(new Button());
button.x = 2048 / 2;
button.y = 2732 - 150;
LK.gui.top.addChild(scoreTxt);
game.down = function (x, y, obj) {
	bird.y -= 100;
	if (x < bird.x) {
		bird.x -= 100;
	} else if (x > bird.x) {
		bird.x += 100;
	}
};
var boss;
game.update = function () {
	if (bird.y > 2732) {
		LK.showGameOver();
	}
	if (LK.getScore() == 10 && !boss) {
		boss = game.addChild(new Boss());
		boss.x = 2048 / 2;
		boss.y = 0;
	}
	// Create more enemies when score reaches 20, 30, 40 and so on
	if (LK.getScore() % 10 == 0 && LK.getScore() != 0) {
		var enemy = game.addChild(new Enemy());
		enemy.x = Math.random() * 2048;
		enemy.y = Math.random() * 2732;
	}
};
 Apple. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
 Bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
 Bird. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
 Shoot button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.