/****
* Classes
****/
// Class for the bucket
var Bucket = Container.expand(function () {
  var self = Container.call(this);
  var bucketGraphics = self.attachAsset('bucket', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.move = function (x) {
    self.x = x;
  };
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the falling objects
var FallingObject = Container.expand(function () {
  var self = Container.call(this);
  var objectGraphics = self.attachAsset('fallingObject', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.speed = 5;
  self.update = function () {
    self.y += self.speed;
  };
});
/****
* Initialize Game
****/
var game = new LK.Game({
  backgroundColor: 0x000000 //Init game with black background 
});
/****
* Game Code
****/
// Initialize bucket
var bucket = game.addChild(new Bucket());
bucket.x = 2048 / 2;
bucket.y = 2500;
// Array to keep track of falling objects
var fallingObjects = [];
// Function to handle move events
function handleMove(x, y, obj) {
  bucket.move(x);
}
// Mouse or touch move on game object
game.move = handleMove;
// Game update function
game.update = function () {
  // Update falling objects
  for (var i = fallingObjects.length - 1; i >= 0; i--) {
    var fallingObject = fallingObjects[i];
    fallingObject.update();
    // Check if the object is off-screen
    if (fallingObject.y > 2732) {
      fallingObject.destroy();
      fallingObjects.splice(i, 1);
      continue;
    }
    // Check for collision with the bucket
    if (fallingObject.intersects(bucket)) {
      // Increase score
      LK.setScore(LK.getScore() + 1);
      fallingObject.destroy();
      fallingObjects.splice(i, 1);
    }
  }
  // Spawn new falling object
  if (LK.ticks % 60 == 0) {
    var newFallingObject = new FallingObject();
    newFallingObject.x = Math.random() * 2048;
    newFallingObject.y = 0;
    fallingObjects.push(newFallingObject);
    game.addChild(newFallingObject);
  }
};
// Display score
var scoreTxt = new Text2('0', {
  size: 150,
  fill: 0xFFFFFF
});
scoreTxt.setText(LK.getScore());
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt); /****
* Classes
****/
// Class for the bucket
var Bucket = Container.expand(function () {
  var self = Container.call(this);
  var bucketGraphics = self.attachAsset('bucket', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.move = function (x) {
    self.x = x;
  };
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the falling objects
var FallingObject = Container.expand(function () {
  var self = Container.call(this);
  var objectGraphics = self.attachAsset('fallingObject', {
    anchorX: 0.5,
    anchorY: 0.5
  });
  self.speed = 5;
  self.update = function () {
    self.y += self.speed;
  };
});
/****
* Initialize Game
****/
var game = new LK.Game({
  backgroundColor: 0x000000 //Init game with black background 
});
/****
* Game Code
****/
// Initialize bucket
var bucket = game.addChild(new Bucket());
bucket.x = 2048 / 2;
bucket.y = 2500;
// Array to keep track of falling objects
var fallingObjects = [];
// Function to handle move events
function handleMove(x, y, obj) {
  bucket.move(x);
}
// Mouse or touch move on game object
game.move = handleMove;
// Game update function
game.update = function () {
  // Update falling objects
  for (var i = fallingObjects.length - 1; i >= 0; i--) {
    var fallingObject = fallingObjects[i];
    fallingObject.update();
    // Check if the object is off-screen
    if (fallingObject.y > 2732) {
      fallingObject.destroy();
      fallingObjects.splice(i, 1);
      continue;
    }
    // Check for collision with the bucket
    if (fallingObject.intersects(bucket)) {
      // Increase score
      LK.setScore(LK.getScore() + 1);
      fallingObject.destroy();
      fallingObjects.splice(i, 1);
    }
  }
  // Spawn new falling object
  if (LK.ticks % 60 == 0) {
    var newFallingObject = new FallingObject();
    newFallingObject.x = Math.random() * 2048;
    newFallingObject.y = 0;
    fallingObjects.push(newFallingObject);
    game.addChild(newFallingObject);
  }
};
// Display score
var scoreTxt = new Text2('0', {
  size: 150,
  fill: 0xFFFFFF
});
scoreTxt.setText(LK.getScore());
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
 Mole. Single Game Texture. In-Game asset. Blank background. High contrast. No shadows
 Drop Of water. Single Game Texture. In-Game asset. Blank background. High contrast. No shadows
 Bucket. Single Game Texture. In-Game asset. Blank background. High contrast. No shadows
 Sewer. Single Game Texture. In-Game asset. Blank background. High contrast. No shadows