/**** 
* Classes
****/ 
var BubbleTea = Container.expand(function () {
	var self = Container.call(this);
	var teaGraphics = self.attachAsset('bubbleTea', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.ingredients = [];
	self.speed = 10;
	self["catch"] = function (ingredient) {
		self.ingredients.push(ingredient);
	};
	self._move_migrated = function (direction) {
		self.x += self.speed * direction;
		if (self.x < teaGraphics.width / 2) {
			self.x = teaGraphics.width / 2;
		}
		if (self.x > 2048 - teaGraphics.width / 2) {
			self.x = 2048 - teaGraphics.width / 2;
		}
		if (self.y < teaGraphics.height / 2) {
			self.y = teaGraphics.height / 2;
		}
		if (self.y > 2732 - teaGraphics.height / 2) {
			self.y = 2732 - teaGraphics.height / 2;
		}
	};
});
var Customer = Container.expand(function () {
	var self = Container.call(this);
	var customerGraphics = self.attachAsset('customer', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speechBubble = self.addChild(new SpeechBubble(''));
	self.speechBubble.y = -self.speechBubble.height - 30;
});
var Ingredient = Container.expand(function (id) {
	var self = Container.call(this);
	self.id = id;
	self.speed = Math.random() * 10 + 6;
	var ingredientGraphics = self.createAsset('ingredient' + id, {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self._move_migrated = function () {
		self.y += self.speed;
		if (self.y > 2732) {
			self.y = 2732;
		}
		if (self.x < ingredientGraphics.width / 2) {
			self.x = ingredientGraphics.width / 2;
		}
		if (self.x > 2048 - ingredientGraphics.width / 2) {
			self.x = 2048 - ingredientGraphics.width / 2;
		}
	};
	self.add = function () {};
});
var SpeechBubble = Container.expand(function (text) {
	var self = Container.call(this);
	var bubbleGraphics = self.attachAsset('speechBubble', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	var bubbleText = new Text2(text, {
		size: 50,
		fill: '#000000'
	});
	bubbleText.anchor.set(.5, .5);
	self.addChild(bubbleText);
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
var score = 0;
var scoreTxt = new Text2(score.toString(), {
	size: 100,
	fill: '#FFA500'
});
scoreTxt.anchor.set(0.5, 0.5);
var scoreBox = LK.getAsset('scoreBox', {});
scoreBox.width = 200;
scoreBox.height = 100;
scoreBox.x = 2048 - scoreBox.width / 2;
scoreBox.y = 2732 - scoreBox.height / 2;
game.addChild(scoreBox);
scoreBox.addChild(scoreTxt);
scoreTxt.x = scoreBox.width / 2;
scoreTxt.y = scoreBox.height / 2;
game.updateScore = function (newScore) {
	score = newScore;
	scoreTxt.setText(score.toString());
};
var background = game.attachAsset('background', {
	anchorX: 0.5,
	anchorY: 0.5
});
game.addChild(background);
background.width = 2048;
background.height = 2732;
background.x = 2048 / 2;
background.y = 2732 / 2;
var ingredients = [];
var customer = game.addChild(new Customer());
customer.x = 500;
customer.y = 2732 - customer.height / 2 + 300;
var bubbleTea = game.addChild(new BubbleTea());
bubbleTea.x = 2048 / 2;
bubbleTea.y = 2732 - bubbleTea.height / 2;
game.on('move', function (x, y, obj) {
	var event = obj;
	var pos = game.toLocal(event.global);
	bubbleTea.x = pos.x;
});
LK.on('tick', function () {
	for (var a = ingredients.length - 1; a >= 0; a--) {
		ingredients[a]._move_migrated();
		if (ingredients[a].y >= 2732) {
			LK.showGameOver();
		} else if (bubbleTea.intersects(ingredients[a])) {
			bubbleTea["catch"](ingredients[a]);
			ingredients[a].destroy();
			ingredients.splice(a, 1);
			game.updateScore(score + ingredients[a].speed);
		}
	}
	if (LK.ticks % 60 == 0) {
		var newIngredient = new Ingredient(Math.floor(Math.random() * 5));
		newIngredient.x = Math.random() * 2048;
		newIngredient.y = -newIngredient.height;
		ingredients.push(newIngredient);
		game.addChild(newIngredient);
	}
}); /**** 
* Classes
****/ 
var BubbleTea = Container.expand(function () {
	var self = Container.call(this);
	var teaGraphics = self.attachAsset('bubbleTea', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.ingredients = [];
	self.speed = 10;
	self["catch"] = function (ingredient) {
		self.ingredients.push(ingredient);
	};
	self._move_migrated = function (direction) {
		self.x += self.speed * direction;
		if (self.x < teaGraphics.width / 2) {
			self.x = teaGraphics.width / 2;
		}
		if (self.x > 2048 - teaGraphics.width / 2) {
			self.x = 2048 - teaGraphics.width / 2;
		}
		if (self.y < teaGraphics.height / 2) {
			self.y = teaGraphics.height / 2;
		}
		if (self.y > 2732 - teaGraphics.height / 2) {
			self.y = 2732 - teaGraphics.height / 2;
		}
	};
});
var Customer = Container.expand(function () {
	var self = Container.call(this);
	var customerGraphics = self.attachAsset('customer', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speechBubble = self.addChild(new SpeechBubble(''));
	self.speechBubble.y = -self.speechBubble.height - 30;
});
var Ingredient = Container.expand(function (id) {
	var self = Container.call(this);
	self.id = id;
	self.speed = Math.random() * 10 + 6;
	var ingredientGraphics = self.createAsset('ingredient' + id, {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self._move_migrated = function () {
		self.y += self.speed;
		if (self.y > 2732) {
			self.y = 2732;
		}
		if (self.x < ingredientGraphics.width / 2) {
			self.x = ingredientGraphics.width / 2;
		}
		if (self.x > 2048 - ingredientGraphics.width / 2) {
			self.x = 2048 - ingredientGraphics.width / 2;
		}
	};
	self.add = function () {};
});
var SpeechBubble = Container.expand(function (text) {
	var self = Container.call(this);
	var bubbleGraphics = self.attachAsset('speechBubble', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	var bubbleText = new Text2(text, {
		size: 50,
		fill: '#000000'
	});
	bubbleText.anchor.set(.5, .5);
	self.addChild(bubbleText);
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
var score = 0;
var scoreTxt = new Text2(score.toString(), {
	size: 100,
	fill: '#FFA500'
});
scoreTxt.anchor.set(0.5, 0.5);
var scoreBox = LK.getAsset('scoreBox', {});
scoreBox.width = 200;
scoreBox.height = 100;
scoreBox.x = 2048 - scoreBox.width / 2;
scoreBox.y = 2732 - scoreBox.height / 2;
game.addChild(scoreBox);
scoreBox.addChild(scoreTxt);
scoreTxt.x = scoreBox.width / 2;
scoreTxt.y = scoreBox.height / 2;
game.updateScore = function (newScore) {
	score = newScore;
	scoreTxt.setText(score.toString());
};
var background = game.attachAsset('background', {
	anchorX: 0.5,
	anchorY: 0.5
});
game.addChild(background);
background.width = 2048;
background.height = 2732;
background.x = 2048 / 2;
background.y = 2732 / 2;
var ingredients = [];
var customer = game.addChild(new Customer());
customer.x = 500;
customer.y = 2732 - customer.height / 2 + 300;
var bubbleTea = game.addChild(new BubbleTea());
bubbleTea.x = 2048 / 2;
bubbleTea.y = 2732 - bubbleTea.height / 2;
game.on('move', function (x, y, obj) {
	var event = obj;
	var pos = game.toLocal(event.global);
	bubbleTea.x = pos.x;
});
LK.on('tick', function () {
	for (var a = ingredients.length - 1; a >= 0; a--) {
		ingredients[a]._move_migrated();
		if (ingredients[a].y >= 2732) {
			LK.showGameOver();
		} else if (bubbleTea.intersects(ingredients[a])) {
			bubbleTea["catch"](ingredients[a]);
			ingredients[a].destroy();
			ingredients.splice(a, 1);
			game.updateScore(score + ingredients[a].speed);
		}
	}
	if (LK.ticks % 60 == 0) {
		var newIngredient = new Ingredient(Math.floor(Math.random() * 5));
		newIngredient.x = Math.random() * 2048;
		newIngredient.y = -newIngredient.height;
		ingredients.push(newIngredient);
		game.addChild(newIngredient);
	}
});
:quality(85)/https://cdn.frvr.ai/65595bc875ef1f5d58d3c566.png%3F3) 
 Fruit jelly boba pearls, no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/65595c0175ef1f5d58d3c56d.png%3F3) 
 pile of Fruit jelly boba pearls, no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/65595c4575ef1f5d58d3c575.png%3F3) 
 kawaii harajuku customer, mask, Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/655963be75ef1f5d58d3c591.png%3F3) 
 fruit shiny anime, no face Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/6559640a75ef1f5d58d3c598.png%3F3) 
 boba pearls, pile, no cup, shiny anime Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/6559645675ef1f5d58d3c5a0.png%3F3) 
 red bean, shiny anime, pile no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/655964bb75ef1f5d58d3c5a7.png%3F3) 
 shiny plastic cup, no lid, anime, empty Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/6559651f75ef1f5d58d3c5ad.png%3F3) 
 whipped milk foam, creamy fluff, anime, Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/655965bb75ef1f5d58d3c5b7.png%3F3) 
 flan pudding, shiny, anime Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/65596a3dee4c3883c4624637.png%3F3) 
 anime angry lines, red cross Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/65596e0eee4c3883c4624666.png%3F3) 
 boba tea shop logo, kawaii anime, circular logo Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/6559a6cb75ef1f5d58d3c73f.png%3F3) 
 Tea shop interior, anime cafe Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/655a328258c2a24cff9f8e80.png%3F3) 
 Speech bubble 💬, "don't drop!" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
:quality(85)/https://cdn.frvr.ai/655a394658c2a24cff9f8eb2.png%3F3) 
 UI point box, white square Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.