/**** * 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 / 2; // 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 = 2048 / 2 - 400; self.y = 2732 / 2 + 100; self.hairLength = 5; // Initial hair length // Method to check if the client is satisfied self.isSatisfied = function () { return self.hairLength === 0; }; self.down = function (x, y, obj) { if (self.hairLength > 0) { self.hairLength -= 1; LK.setScore(LK.getScore() + 1); LK.getSound('21').play(); } }; }); // Class for the Game Options var GameOptions = Container.expand(function () { var self = Container.call(this); self.option1 = "Namazov Style"; self.option2 = "Vusal istili"; self.selectedOption = null; // Method to select an option self.selectOption = function (option) { if (option === self.option2) { self.selectedOption = option; } else { console.log("You can only select the second option!"); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundImage: 'background' }); /**** * Game Code ****/ // Add new background asset // Add the background to the game var background = game.addChild(LK.getAsset('background', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0, width: 2048, height: 2732 })); // Initialize game options and select the second option var gameOptions = new GameOptions(); gameOptions.selectOption(gameOptions.option2); // Initialize barber var barber = game.addChild(new Barber()); // Initialize clients array and add a client var clients = []; clients.push(game.addChild(new Client())); // Score display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(1, 0); LK.gui.topRight.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) { var touchedClient = false; for (var i = 0; i < clients.length; i++) { if (barber.intersects(clients[i])) { barber.cutHair(clients[i]); touchedClient = true; } } if (!touchedClient) { LK.showGameOver(); } }; // Create a 10 second timer var timer = LK.setTimeout(function () { if (LK.getScore() < 200) { LK.showGameOver("Boyunu Yere Soxum"); } else if (LK.getScore() >= 200) { LK.showYouWin("Sizde Artiq vusal istilini secdiniz"); } }, 10000);
/****
* 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 / 2;
// 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 = 2048 / 2 - 400;
self.y = 2732 / 2 + 100;
self.hairLength = 5; // Initial hair length
// Method to check if the client is satisfied
self.isSatisfied = function () {
return self.hairLength === 0;
};
self.down = function (x, y, obj) {
if (self.hairLength > 0) {
self.hairLength -= 1;
LK.setScore(LK.getScore() + 1);
LK.getSound('21').play();
}
};
});
// Class for the Game Options
var GameOptions = Container.expand(function () {
var self = Container.call(this);
self.option1 = "Namazov Style";
self.option2 = "Vusal istili";
self.selectedOption = null;
// Method to select an option
self.selectOption = function (option) {
if (option === self.option2) {
self.selectedOption = option;
} else {
console.log("You can only select the second option!");
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundImage: 'background'
});
/****
* Game Code
****/
// Add new background asset
// Add the background to the game
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.0,
anchorY: 0.0,
x: 0,
y: 0,
width: 2048,
height: 2732
}));
// Initialize game options and select the second option
var gameOptions = new GameOptions();
gameOptions.selectOption(gameOptions.option2);
// Initialize barber
var barber = game.addChild(new Barber());
// Initialize clients array and add a client
var clients = [];
clients.push(game.addChild(new Client()));
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(1, 0);
LK.gui.topRight.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) {
var touchedClient = false;
for (var i = 0; i < clients.length; i++) {
if (barber.intersects(clients[i])) {
barber.cutHair(clients[i]);
touchedClient = true;
}
}
if (!touchedClient) {
LK.showGameOver();
}
};
// Create a 10 second timer
var timer = LK.setTimeout(function () {
if (LK.getScore() < 200) {
LK.showGameOver("Boyunu Yere Soxum");
} else if (LK.getScore() >= 200) {
LK.showYouWin("Sizde Artiq vusal istilini secdiniz");
}
}, 10000);
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