/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the Barber
var Barber = Container.expand(function () {
var self = Container.call(this);
var barberGraphics = self.attachAsset('barber', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 / 2;
self.y = 2732 - 200;
// Method to handle cutting hair
self.cutHair = function (client) {
if (client.hairLength > 0) {
client.hairLength -= 1;
LK.setScore(LK.getScore() + 10);
}
};
});
// Class for the Client
var Client = Container.expand(function () {
var self = Container.call(this);
var clientGraphics = self.attachAsset('client', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = Math.random() * 2048;
self.y = 200;
self.hairLength = 5; // Initial hair length
// Method to check if the client is satisfied
self.isSatisfied = function () {
return self.hairLength === 0;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize barber and clients
var barber = game.addChild(new Barber());
var clients = [];
for (var i = 0; i < 5; i++) {
clients.push(game.addChild(new Client()));
}
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Handle game updates
game.update = function () {
// Check for satisfied clients
for (var i = clients.length - 1; i >= 0; i--) {
if (clients[i].isSatisfied()) {
clients[i].destroy();
clients.splice(i, 1);
// Add a new client
clients.push(game.addChild(new Client()));
}
}
// Update score display
scoreTxt.setText(LK.getScore());
};
// Handle touch events
game.down = function (x, y, obj) {
for (var i = 0; i < clients.length; i++) {
if (barber.intersects(clients[i])) {
barber.cutHair(clients[i]);
}
}
}; /****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the Barber
var Barber = Container.expand(function () {
var self = Container.call(this);
var barberGraphics = self.attachAsset('barber', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 / 2;
self.y = 2732 - 200;
// Method to handle cutting hair
self.cutHair = function (client) {
if (client.hairLength > 0) {
client.hairLength -= 1;
LK.setScore(LK.getScore() + 10);
}
};
});
// Class for the Client
var Client = Container.expand(function () {
var self = Container.call(this);
var clientGraphics = self.attachAsset('client', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = Math.random() * 2048;
self.y = 200;
self.hairLength = 5; // Initial hair length
// Method to check if the client is satisfied
self.isSatisfied = function () {
return self.hairLength === 0;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize barber and clients
var barber = game.addChild(new Barber());
var clients = [];
for (var i = 0; i < 5; i++) {
clients.push(game.addChild(new Client()));
}
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Handle game updates
game.update = function () {
// Check for satisfied clients
for (var i = clients.length - 1; i >= 0; i--) {
if (clients[i].isSatisfied()) {
clients[i].destroy();
clients.splice(i, 1);
// Add a new client
clients.push(game.addChild(new Client()));
}
}
// Update score display
scoreTxt.setText(LK.getScore());
};
// Handle touch events
game.down = function (x, y, obj) {
for (var i = 0; i < clients.length; i++) {
if (barber.intersects(clients[i])) {
barber.cutHair(clients[i]);
}
}
};
sakallı ve az bıyıklı güneş gözlüklü 26 lı yaşlarda bir beyefendi ayak üstünde dursun üzerinde önlük olsun. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
100x140 barber background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows