/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
coins: 0,
weaponLevel: 0
});
/****
* Classes
****/
var Character = Container.expand(function () {
var self = Container.call(this);
self.health = 3; // Initialize character health
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
dragNode = self;
handleMove(x, y, obj);
};
self.up = function (x, y, obj) {
dragNode = null;
};
self.hitBox = new Rectangle(self.x - characterGraphics.width / 2, self.y - characterGraphics.height / 2, characterGraphics.width, characterGraphics.height);
self.update = function () {
self.hitBox.x = self.x - characterGraphics.width / 2;
self.hitBox.y = self.y - characterGraphics.height / 2;
// Prevent character from moving out of the screen boundaries
if (self.x - characterGraphics.width / 2 < 0) {
self.x = characterGraphics.width / 2;
}
if (self.x + characterGraphics.width / 2 > 2048) {
self.x = 2048 - characterGraphics.width / 2;
}
if (self.y - characterGraphics.height / 2 < 0) {
self.y = characterGraphics.height / 2;
}
if (self.y + characterGraphics.height / 2 > 2732) {
self.y = 2732 - characterGraphics.height / 2;
}
};
return self;
});
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 3; // Example health value
self.speed = 2 / self.health; // The stronger the enemy, the slower it moves
self.update = function () {
// Example enemy movement logic
// Calculate direction towards the character
var dx = character.x - self.x;
var dy = character.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Normalize direction and move towards the character
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
};
self.armor = Math.random() > 0.5 ? 1 : 0; // 50% chance to have armor
self.killBox = new Rectangle(self.x - enemyGraphics.width / 2, self.y - enemyGraphics.height / 2, enemyGraphics.width, enemyGraphics.height);
self.update = function () {
self.killBox.x = self.x - enemyGraphics.width / 2;
self.killBox.y = self.y - enemyGraphics.height / 2;
// Example enemy movement logic
// Calculate direction towards the character
var dx = character.x - self.x;
var dy = character.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Normalize direction and move towards the character
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
};
return self;
});
var Gun = Container.expand(function () {
var self = Container.call(this);
self.level = 1; // Initial gun level
self.upgradeCost = 100; // Cost to upgrade the gun
self.upgrade = function () {
if (storage.coins >= self.upgradeCost) {
storage.coins -= self.upgradeCost;
self.level += 1;
self.upgradeCost *= 2; // Increase cost for next upgrade
scoreTxt.setText('Coins: ' + storage.coins);
return true;
}
return false;
};
return self;
});
var House = Container.expand(function () {
var self = Container.call(this);
var houseGraphics = self.attachAsset('house', {
anchorX: 0.5,
anchorY: 0.5
});
// Remove hitbox to make the house non-solid
return self;
});
var Shop = Container.expand(function () {
var self = Container.call(this);
var shopGraphics = self.attachAsset('shop', {
anchorX: 0.5,
anchorY: 0.5
});
self.purchaseWeapon = function (weaponCost) {
if (storage.coins >= weaponCost) {
storage.coins -= weaponCost;
scoreTxt.setText('Coins: ' + storage.coins);
return true;
} else if (gun.upgrade()) {
console.log("Gun upgraded to level " + gun.level);
return true;
}
return false;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
function showShopMenu() {
console.log("Displaying shop menu...");
// Example: Check if the player can purchase or upgrade a weapon
if (!character.gun) {
character.gun = new Gun();
character.addChild(character.gun);
character.gun.x = 0; // Position gun relative to character
character.gun.y = 0; // Position gun relative to character
}
// Logic to display shop options and handle purchases
if (shop.purchaseWeapon(character.gun.upgradeCost)) {
console.log("Weapon purchased or upgraded!");
} else {
console.log("Not enough coins to purchase or upgrade weapon.");
}
}
function rectanglesIntersect(rect1, rect2) {
return !(rect2.x > rect1.x + rect1.width || rect2.x + rect2.width < rect1.x || rect2.y > rect1.y + rect1.height || rect2.y + rect2.height < rect1.y);
}
function showGunSelectionMenu() {
// Logic to display gun selection menu
console.log("Displaying gun selection menu...");
// Example: Check if the player can purchase or upgrade a weapon
console.log("Weapon selection or upgrade available!");
if (!character.gun) {
character.gun = new Gun();
character.addChild(character.gun);
character.gun.x = 0; // Position gun relative to character
character.gun.y = 0; // Position gun relative to character
}
}
// Initialize assets used in this game. Scale them according to what is needed for the game.
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
});
game.addChild(background);
var character = game.addChild(new Character());
var shop = game.addChild(new Shop());
var house = game.addChild(new House());
house.x = 1800; // Position the house on the right side of the screen
house.y = 2100; // Move the house slightly upwards on the screen
var gun = new Gun();
character.speed = 7; // Set initial character speed
character.stamina = 100; // Initialize character stamina
shop.x = 1800; // Position the shop on the right side of the screen
shop.y = 1366;
character.x = house.x - house.width / 2 - character.width / 2 - 50; // Position character to the left of the house
character.y = house.y; // Keep character at the same y position as the house
character.stamina = 100; // Initialize character stamina
var coins = [];
var enemies = [];
var dragNode = null;
var friendlyFireEnabled = true; // Enable friendly fire
var timerBar = new Container(); // Create a container for the time bar
timerBar.x = 1024; // Center horizontally
timerBar.y = 2300; // Move the time bar 10 cm up from its current position
timerBar.width = 800; // Set the width of the time bar
timerBar.height = 50; // Set the height of the time bar
timerBar.anchorX = 0.5; // Center the anchor point
timerBar.anchorY = 0.5; // Center the anchor point
timerBar.color = 0x00FF00; // Set the color of the time bar to green
game.addChild(timerBar); // Add the time bar to the game
var scoreTxt = new Text2('Coins: ' + storage.coins, {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt); // Move score text to the middle top of the screen
var timerTxt = new Text2('Time: 0s', {
size: 100,
fill: 0xFFFFFF
});
timerTxt.anchor.set(0.5, 0.5);
LK.gui.bottom.addChild(timerTxt);
// Add a pause button to the game interface
var pauseButton = new Text2('Pause', {
size: 100,
fill: 0xFFFFFF
});
pauseButton.anchor.set(0.5, 0);
pauseButton.x = 1024; // Center horizontally
pauseButton.y = 50; // Position near the top
LK.gui.top.addChild(pauseButton);
// Add a run button to the game interface
var runButton = new Text2('Run', {
size: 100,
fill: 0xFFFFFF
});
runButton.anchor.set(0.5, 0);
runButton.x = 1024; // Center horizontally
runButton.y = 150; // Position below the pause button
LK.gui.top.addChild(runButton);
// Add a code entry button to the game interface
var codeButton = new Text2('Enter Code', {
size: 100,
fill: 0xFFFFFF
});
codeButton.anchor.set(0.5, 0);
codeButton.x = 1024; // Center horizontally
codeButton.y = 350; // Position below the coins counter bar
LK.gui.top.addChild(codeButton);
// Add event listener for code button
codeButton.down = function () {
var code = prompt("Enter your code:");
if (code === "GUN100") {
storage.coins += 100;
scoreTxt.setText('Coins: ' + storage.coins);
console.log("Code accepted: 100 coins added!");
} else if (code === "GUNUPGRADE") {
if (gun.upgrade()) {
console.log("Gun upgraded to level " + gun.level);
} else {
console.log("Not enough coins to upgrade gun.");
}
} else {
console.log("Invalid code.");
}
};
// Add event listener for run button
runButton.down = function () {
if (character.speed === 7 && character.stamina > 0) {
character.speed = 12; // Increase speed
runButton.setText('Walk');
} else {
character.speed = 7; // Reset to normal speed
runButton.setText('Run');
}
};
// Add event listener for pause button
pauseButton.down = function () {
if (game.paused) {
game.resume();
pauseButton.setText('Pause');
} else {
game.pause();
pauseButton.setText('Resume');
}
};
function handleMove(x, y, obj) {
if (dragNode) {
var dx = x - dragNode.x;
var dy = y - dragNode.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
var speed = character.speed; // Use character's speed
dragNode.x += dx / distance * speed;
dragNode.y += dy / distance * speed;
}
// Update character position based on dragNode
character.x = dragNode.x;
character.y = dragNode.y;
} else {
// Allow character to move independently
character.x += character.speed;
character.y += character.speed;
}
}
game.move = handleMove;
character.down = function (x, y, obj) {
dragNode = character;
handleMove(x, y, obj);
};
character.up = function (x, y, obj) {
dragNode = null;
};
game.update = function () {
if (game.paused) {
return;
} // Skip update logic if the game is paused
// Update character position based on dragNode
if (dragNode) {
character.x = dragNode.x;
character.y = dragNode.y;
} else {
// Ensure character can move independently of dragNode
character.update();
}
// Deplete stamina when running
if (character.speed > 7 && character.stamina > 0) {
character.stamina -= 0.5;
if (character.stamina <= 0) {
character.speed = 7; // Reset to normal speed when stamina is depleted
runButton.setText('Run');
}
}
// Regenerate stamina when not running
if (character.speed === 7 && character.stamina < 100) {
character.stamina += 0.1;
}
if (LK.ticks % 60 == 0) {
var secondsSurvived = Math.floor(LK.ticks / 60);
timerTxt.setText('Time: ' + secondsSurvived + 's');
var totalGameTime = 300; // Total game time in seconds
var remainingTime = totalGameTime - secondsSurvived; // Calculate remaining time
timerBar.width = remainingTime / totalGameTime * 800; // Update the width of the time bar based on remaining time
var newCoin = new Coin();
newCoin.x = Math.random() * 2048;
newCoin.y = Math.random() * 2732;
coins.push(newCoin);
game.addChild(newCoin);
}
if (LK.ticks % 120 == 0) {
var newEnemy = new Enemy();
LK.getSound('zombieGrowl').play();
newEnemy.x = Math.random() * 2048;
newEnemy.y = 0;
enemies.push(newEnemy);
game.addChild(newEnemy);
}
for (var i = coins.length - 1; i >= 0; i--) {
if (character.intersects(coins[i])) {
storage.coins += 1;
if (storage.coins % 10 === 0) {
character.stamina = 100; // Refill stamina every 10 coins
}
scoreTxt.setText('Coins: ' + storage.coins);
LK.getSound('coinCollect').play();
coins[i].x = -coins[i].width; // Move coin out of the screen
coins[i].y = -coins[i].height; // Move coin out of the screen
coins[i].destroy();
coins.splice(i, 1);
}
}
for (var j = enemies.length - 1; j >= 0; j--) {
enemies[j].update();
if (rectanglesIntersect(character.hitBox, enemies[j].killBox)) {
character.health -= 1;
if (character.health <= 0) {
character.x = -character.hitBox.width; // Move character out of the screen
character.y = -character.hitBox.height; // Move character out of the screen
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
shop.down = function (x, y, obj) {
showShopMenu();
console.log("Shop menu opened");
};
if (enemies[j].health <= 0) {
storage.coins += 5;
scoreTxt.setText('Coins: ' + storage.coins);
LK.getSound('enemyDefeat').play();
enemies[j].x = -enemyGraphics.width; // Move enemy out of the screen
enemies[j].y = -enemyGraphics.height; // Move enemy out of the screen
enemies[j].destroy();
enemies.splice(j, 1);
}
}
};
LK.playMusic('backgroundMusic', {
loop: true
}); /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
coins: 0,
weaponLevel: 0
});
/****
* Classes
****/
var Character = Container.expand(function () {
var self = Container.call(this);
self.health = 3; // Initialize character health
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
dragNode = self;
handleMove(x, y, obj);
};
self.up = function (x, y, obj) {
dragNode = null;
};
self.hitBox = new Rectangle(self.x - characterGraphics.width / 2, self.y - characterGraphics.height / 2, characterGraphics.width, characterGraphics.height);
self.update = function () {
self.hitBox.x = self.x - characterGraphics.width / 2;
self.hitBox.y = self.y - characterGraphics.height / 2;
// Prevent character from moving out of the screen boundaries
if (self.x - characterGraphics.width / 2 < 0) {
self.x = characterGraphics.width / 2;
}
if (self.x + characterGraphics.width / 2 > 2048) {
self.x = 2048 - characterGraphics.width / 2;
}
if (self.y - characterGraphics.height / 2 < 0) {
self.y = characterGraphics.height / 2;
}
if (self.y + characterGraphics.height / 2 > 2732) {
self.y = 2732 - characterGraphics.height / 2;
}
};
return self;
});
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 3; // Example health value
self.speed = 2 / self.health; // The stronger the enemy, the slower it moves
self.update = function () {
// Example enemy movement logic
// Calculate direction towards the character
var dx = character.x - self.x;
var dy = character.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Normalize direction and move towards the character
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
};
self.armor = Math.random() > 0.5 ? 1 : 0; // 50% chance to have armor
self.killBox = new Rectangle(self.x - enemyGraphics.width / 2, self.y - enemyGraphics.height / 2, enemyGraphics.width, enemyGraphics.height);
self.update = function () {
self.killBox.x = self.x - enemyGraphics.width / 2;
self.killBox.y = self.y - enemyGraphics.height / 2;
// Example enemy movement logic
// Calculate direction towards the character
var dx = character.x - self.x;
var dy = character.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Normalize direction and move towards the character
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
};
return self;
});
var Gun = Container.expand(function () {
var self = Container.call(this);
self.level = 1; // Initial gun level
self.upgradeCost = 100; // Cost to upgrade the gun
self.upgrade = function () {
if (storage.coins >= self.upgradeCost) {
storage.coins -= self.upgradeCost;
self.level += 1;
self.upgradeCost *= 2; // Increase cost for next upgrade
scoreTxt.setText('Coins: ' + storage.coins);
return true;
}
return false;
};
return self;
});
var House = Container.expand(function () {
var self = Container.call(this);
var houseGraphics = self.attachAsset('house', {
anchorX: 0.5,
anchorY: 0.5
});
// Remove hitbox to make the house non-solid
return self;
});
var Shop = Container.expand(function () {
var self = Container.call(this);
var shopGraphics = self.attachAsset('shop', {
anchorX: 0.5,
anchorY: 0.5
});
self.purchaseWeapon = function (weaponCost) {
if (storage.coins >= weaponCost) {
storage.coins -= weaponCost;
scoreTxt.setText('Coins: ' + storage.coins);
return true;
} else if (gun.upgrade()) {
console.log("Gun upgraded to level " + gun.level);
return true;
}
return false;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
function showShopMenu() {
console.log("Displaying shop menu...");
// Example: Check if the player can purchase or upgrade a weapon
if (!character.gun) {
character.gun = new Gun();
character.addChild(character.gun);
character.gun.x = 0; // Position gun relative to character
character.gun.y = 0; // Position gun relative to character
}
// Logic to display shop options and handle purchases
if (shop.purchaseWeapon(character.gun.upgradeCost)) {
console.log("Weapon purchased or upgraded!");
} else {
console.log("Not enough coins to purchase or upgrade weapon.");
}
}
function rectanglesIntersect(rect1, rect2) {
return !(rect2.x > rect1.x + rect1.width || rect2.x + rect2.width < rect1.x || rect2.y > rect1.y + rect1.height || rect2.y + rect2.height < rect1.y);
}
function showGunSelectionMenu() {
// Logic to display gun selection menu
console.log("Displaying gun selection menu...");
// Example: Check if the player can purchase or upgrade a weapon
console.log("Weapon selection or upgrade available!");
if (!character.gun) {
character.gun = new Gun();
character.addChild(character.gun);
character.gun.x = 0; // Position gun relative to character
character.gun.y = 0; // Position gun relative to character
}
}
// Initialize assets used in this game. Scale them according to what is needed for the game.
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
});
game.addChild(background);
var character = game.addChild(new Character());
var shop = game.addChild(new Shop());
var house = game.addChild(new House());
house.x = 1800; // Position the house on the right side of the screen
house.y = 2100; // Move the house slightly upwards on the screen
var gun = new Gun();
character.speed = 7; // Set initial character speed
character.stamina = 100; // Initialize character stamina
shop.x = 1800; // Position the shop on the right side of the screen
shop.y = 1366;
character.x = house.x - house.width / 2 - character.width / 2 - 50; // Position character to the left of the house
character.y = house.y; // Keep character at the same y position as the house
character.stamina = 100; // Initialize character stamina
var coins = [];
var enemies = [];
var dragNode = null;
var friendlyFireEnabled = true; // Enable friendly fire
var timerBar = new Container(); // Create a container for the time bar
timerBar.x = 1024; // Center horizontally
timerBar.y = 2300; // Move the time bar 10 cm up from its current position
timerBar.width = 800; // Set the width of the time bar
timerBar.height = 50; // Set the height of the time bar
timerBar.anchorX = 0.5; // Center the anchor point
timerBar.anchorY = 0.5; // Center the anchor point
timerBar.color = 0x00FF00; // Set the color of the time bar to green
game.addChild(timerBar); // Add the time bar to the game
var scoreTxt = new Text2('Coins: ' + storage.coins, {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt); // Move score text to the middle top of the screen
var timerTxt = new Text2('Time: 0s', {
size: 100,
fill: 0xFFFFFF
});
timerTxt.anchor.set(0.5, 0.5);
LK.gui.bottom.addChild(timerTxt);
// Add a pause button to the game interface
var pauseButton = new Text2('Pause', {
size: 100,
fill: 0xFFFFFF
});
pauseButton.anchor.set(0.5, 0);
pauseButton.x = 1024; // Center horizontally
pauseButton.y = 50; // Position near the top
LK.gui.top.addChild(pauseButton);
// Add a run button to the game interface
var runButton = new Text2('Run', {
size: 100,
fill: 0xFFFFFF
});
runButton.anchor.set(0.5, 0);
runButton.x = 1024; // Center horizontally
runButton.y = 150; // Position below the pause button
LK.gui.top.addChild(runButton);
// Add a code entry button to the game interface
var codeButton = new Text2('Enter Code', {
size: 100,
fill: 0xFFFFFF
});
codeButton.anchor.set(0.5, 0);
codeButton.x = 1024; // Center horizontally
codeButton.y = 350; // Position below the coins counter bar
LK.gui.top.addChild(codeButton);
// Add event listener for code button
codeButton.down = function () {
var code = prompt("Enter your code:");
if (code === "GUN100") {
storage.coins += 100;
scoreTxt.setText('Coins: ' + storage.coins);
console.log("Code accepted: 100 coins added!");
} else if (code === "GUNUPGRADE") {
if (gun.upgrade()) {
console.log("Gun upgraded to level " + gun.level);
} else {
console.log("Not enough coins to upgrade gun.");
}
} else {
console.log("Invalid code.");
}
};
// Add event listener for run button
runButton.down = function () {
if (character.speed === 7 && character.stamina > 0) {
character.speed = 12; // Increase speed
runButton.setText('Walk');
} else {
character.speed = 7; // Reset to normal speed
runButton.setText('Run');
}
};
// Add event listener for pause button
pauseButton.down = function () {
if (game.paused) {
game.resume();
pauseButton.setText('Pause');
} else {
game.pause();
pauseButton.setText('Resume');
}
};
function handleMove(x, y, obj) {
if (dragNode) {
var dx = x - dragNode.x;
var dy = y - dragNode.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
var speed = character.speed; // Use character's speed
dragNode.x += dx / distance * speed;
dragNode.y += dy / distance * speed;
}
// Update character position based on dragNode
character.x = dragNode.x;
character.y = dragNode.y;
} else {
// Allow character to move independently
character.x += character.speed;
character.y += character.speed;
}
}
game.move = handleMove;
character.down = function (x, y, obj) {
dragNode = character;
handleMove(x, y, obj);
};
character.up = function (x, y, obj) {
dragNode = null;
};
game.update = function () {
if (game.paused) {
return;
} // Skip update logic if the game is paused
// Update character position based on dragNode
if (dragNode) {
character.x = dragNode.x;
character.y = dragNode.y;
} else {
// Ensure character can move independently of dragNode
character.update();
}
// Deplete stamina when running
if (character.speed > 7 && character.stamina > 0) {
character.stamina -= 0.5;
if (character.stamina <= 0) {
character.speed = 7; // Reset to normal speed when stamina is depleted
runButton.setText('Run');
}
}
// Regenerate stamina when not running
if (character.speed === 7 && character.stamina < 100) {
character.stamina += 0.1;
}
if (LK.ticks % 60 == 0) {
var secondsSurvived = Math.floor(LK.ticks / 60);
timerTxt.setText('Time: ' + secondsSurvived + 's');
var totalGameTime = 300; // Total game time in seconds
var remainingTime = totalGameTime - secondsSurvived; // Calculate remaining time
timerBar.width = remainingTime / totalGameTime * 800; // Update the width of the time bar based on remaining time
var newCoin = new Coin();
newCoin.x = Math.random() * 2048;
newCoin.y = Math.random() * 2732;
coins.push(newCoin);
game.addChild(newCoin);
}
if (LK.ticks % 120 == 0) {
var newEnemy = new Enemy();
LK.getSound('zombieGrowl').play();
newEnemy.x = Math.random() * 2048;
newEnemy.y = 0;
enemies.push(newEnemy);
game.addChild(newEnemy);
}
for (var i = coins.length - 1; i >= 0; i--) {
if (character.intersects(coins[i])) {
storage.coins += 1;
if (storage.coins % 10 === 0) {
character.stamina = 100; // Refill stamina every 10 coins
}
scoreTxt.setText('Coins: ' + storage.coins);
LK.getSound('coinCollect').play();
coins[i].x = -coins[i].width; // Move coin out of the screen
coins[i].y = -coins[i].height; // Move coin out of the screen
coins[i].destroy();
coins.splice(i, 1);
}
}
for (var j = enemies.length - 1; j >= 0; j--) {
enemies[j].update();
if (rectanglesIntersect(character.hitBox, enemies[j].killBox)) {
character.health -= 1;
if (character.health <= 0) {
character.x = -character.hitBox.width; // Move character out of the screen
character.y = -character.hitBox.height; // Move character out of the screen
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
shop.down = function (x, y, obj) {
showShopMenu();
console.log("Shop menu opened");
};
if (enemies[j].health <= 0) {
storage.coins += 5;
scoreTxt.setText('Coins: ' + storage.coins);
LK.getSound('enemyDefeat').play();
enemies[j].x = -enemyGraphics.width; // Move enemy out of the screen
enemies[j].y = -enemyGraphics.height; // Move enemy out of the screen
enemies[j].destroy();
enemies.splice(j, 1);
}
}
};
LK.playMusic('backgroundMusic', {
loop: true
});
Make it look like a shop. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A scary zombie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A realistic coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A running man running for his life. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A house. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Zombie apocalypse city. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows