/****
* Classes
****/
// Class for the Button
var Button = Container.expand(function () {
  var self = Container.call(this);
  var buttonGraphics = self.attachAsset('button', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.x = 1024; // Center horizontally
  self.y = 2000; // Position near the bottom
  self.down = function (x, y, obj) {
    // Trigger slap on son
    son.slapped();
    // Increase score
    LK.setScore(LK.getScore() + 1);
    scoreTxt.setText(LK.getScore());
  };
  return self;
});
//<Assets used in the game will automatically appear here>
// Class for the Son
var Son = Container.expand(function () {
  var self = Container.call(this);
  var sonGraphics = self.attachAsset('son', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.x = 1024; // Center horizontally
  self.y = 1366; // Center vertically
  self.slapped = function () {
    // Flash red when slapped
    LK.effects.flashObject(self, 0xff0000, 500);
  };
  return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
  backgroundColor: 0x000000 //Init game with black background 
});
/****
* Game Code
****/
// Initialize score text
var scoreTxt = new Text2('0', {
  size: 150,
  fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Initialize son and button
var son = game.addChild(new Son());
var button = game.addChild(new Button());
// Update function
game.update = function () {
  // Game logic can be added here if needed
}; /****
* Classes
****/
// Class for the Button
var Button = Container.expand(function () {
  var self = Container.call(this);
  var buttonGraphics = self.attachAsset('button', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.x = 1024; // Center horizontally
  self.y = 2000; // Position near the bottom
  self.down = function (x, y, obj) {
    // Trigger slap on son
    son.slapped();
    // Increase score
    LK.setScore(LK.getScore() + 1);
    scoreTxt.setText(LK.getScore());
  };
  return self;
});
//<Assets used in the game will automatically appear here>
// Class for the Son
var Son = Container.expand(function () {
  var self = Container.call(this);
  var sonGraphics = self.attachAsset('son', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.x = 1024; // Center horizontally
  self.y = 1366; // Center vertically
  self.slapped = function () {
    // Flash red when slapped
    LK.effects.flashObject(self, 0xff0000, 500);
  };
  return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
  backgroundColor: 0x000000 //Init game with black background 
});
/****
* Game Code
****/
// Initialize score text
var scoreTxt = new Text2('0', {
  size: 150,
  fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Initialize son and button
var son = game.addChild(new Son());
var button = game.addChild(new Button());
// Update function
game.update = function () {
  // Game logic can be added here if needed
};