/**** * Classes ****/ // Class for Clue var Clue = Container.expand(function () { var self = Container.call(this); var clueGraphics = self.attachAsset('clue', { anchorX: 0.5, anchorY: 0.5 }); self.showClue = function () { // Logic to show clue }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Class for Treasure var Treasure = Container.expand(function () { var self = Container.call(this); var treasureGraphics = self.attachAsset('treasure', { anchorX: 0.5, anchorY: 0.5 }); self.found = false; self.reveal = function () { if (!self.found) { self.found = true; LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.effects.flashObject(self, 0x00ff00, 500); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize treasures and clues var treasures = []; var clues = []; var states = ["Johor", "Kedah", "Kelantan", "Malacca", "Negeri Sembilan", "Pahang", "Penang", "Perak", "Perlis", "Sabah", "Sarawak", "Selangor", "Terengganu"]; // Create treasures and clues for each state states.forEach(function (state, index) { for (var i = 0; i < 10; i++) { var treasure = new Treasure(); treasure.x = Math.random() * 2048; treasure.y = Math.random() * 2732; treasures.push(treasure); game.addChild(treasure); var clue = new Clue(); clue.x = Math.random() * 2048; clue.y = Math.random() * 2732; clues.push(clue); game.addChild(clue); } }); // Score display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Handle touch events game.down = function (x, y, obj) { treasures.forEach(function (treasure) { if (treasure.intersects(obj)) { treasure.reveal(); } }); clues.forEach(function (clue) { if (clue.intersects(obj)) { clue.showClue(); } }); }; // Update game logic game.update = function () { // Game update logic here };
/****
* Classes
****/
// Class for Clue
var Clue = Container.expand(function () {
var self = Container.call(this);
var clueGraphics = self.attachAsset('clue', {
anchorX: 0.5,
anchorY: 0.5
});
self.showClue = function () {
// Logic to show clue
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for Treasure
var Treasure = Container.expand(function () {
var self = Container.call(this);
var treasureGraphics = self.attachAsset('treasure', {
anchorX: 0.5,
anchorY: 0.5
});
self.found = false;
self.reveal = function () {
if (!self.found) {
self.found = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.effects.flashObject(self, 0x00ff00, 500);
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize treasures and clues
var treasures = [];
var clues = [];
var states = ["Johor", "Kedah", "Kelantan", "Malacca", "Negeri Sembilan", "Pahang", "Penang", "Perak", "Perlis", "Sabah", "Sarawak", "Selangor", "Terengganu"];
// Create treasures and clues for each state
states.forEach(function (state, index) {
for (var i = 0; i < 10; i++) {
var treasure = new Treasure();
treasure.x = Math.random() * 2048;
treasure.y = Math.random() * 2732;
treasures.push(treasure);
game.addChild(treasure);
var clue = new Clue();
clue.x = Math.random() * 2048;
clue.y = Math.random() * 2732;
clues.push(clue);
game.addChild(clue);
}
});
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Handle touch events
game.down = function (x, y, obj) {
treasures.forEach(function (treasure) {
if (treasure.intersects(obj)) {
treasure.reveal();
}
});
clues.forEach(function (clue) {
if (clue.intersects(obj)) {
clue.showClue();
}
});
};
// Update game logic
game.update = function () {
// Game update logic here
};
Treasure chest, like kept by the pirates with gold inside. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
stick on papers and envelops. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Man with glasses. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.