User prompt
Make the game more intriguing
User prompt
Make the cop faster
User prompt
When a new cop spawns make it play the Sound Spawn
User prompt
Make the background grey
User prompt
Make it play CashCollect when collected cash
User prompt
I want it so you can hold the player to move it
Initial prompt
Cash Thief
/**** * Classes ****/ // Cash class var Cash = Container.expand(function () { var self = Container.call(this); var cashGraphics = self.attachAsset('cash', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Cash logic if needed }; }); // Guard class var Guard = Container.expand(function () { var self = Container.call(this); var guardGraphics = self.attachAsset('guard', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.update = function () { // Guard movement logic will be handled in the game update loop }; }); //<Assets used in the game will automatically appear here> // Thief class var Thief = Container.expand(function () { var self = Container.call(this); var thiefGraphics = self.attachAsset('thief', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Thief movement logic will be handled in the game update loop }; }); // Trap class var Trap = Container.expand(function () { var self = Container.call(this); var trapGraphics = self.attachAsset('trap', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Trap logic if needed }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var thief = game.addChild(new Thief()); thief.x = 1024; thief.y = 1366; var cashItems = []; var traps = []; var guards = []; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function spawnCash() { var cash = new Cash(); cash.x = Math.random() * 2048; cash.y = Math.random() * 2732; cashItems.push(cash); game.addChild(cash); } function spawnTrap() { var trap = new Trap(); trap.x = Math.random() * 2048; trap.y = Math.random() * 2732; traps.push(trap); game.addChild(trap); } function spawnGuard() { var guard = new Guard(); guard.x = Math.random() * 2048; guard.y = Math.random() * 2732; guards.push(guard); game.addChild(guard); } game.down = function (x, y, obj) { thief.x = x; thief.y = y; }; game.update = function () { for (var i = cashItems.length - 1; i >= 0; i--) { if (thief.intersects(cashItems[i])) { score += 10; LK.setScore(score); scoreTxt.setText(score); cashItems[i].destroy(); cashItems.splice(i, 1); } } for (var i = traps.length - 1; i >= 0; i--) { if (thief.intersects(traps[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } for (var i = guards.length - 1; i >= 0; i--) { if (thief.intersects(guards[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } if (LK.ticks % 120 == 0) { spawnCash(); } if (LK.ticks % 300 == 0) { spawnTrap(); } if (LK.ticks % 600 == 0) { spawnGuard(); } guards.forEach(function (guard) { if (thief.x > guard.x) { guard.x += guard.speed; } else { guard.x -= guard.speed; } if (thief.y > guard.y) { guard.y += guard.speed; } else { guard.y -= guard.speed; } }); };
/****
* Classes
****/
// Cash class
var Cash = Container.expand(function () {
var self = Container.call(this);
var cashGraphics = self.attachAsset('cash', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Cash logic if needed
};
});
// Guard class
var Guard = Container.expand(function () {
var self = Container.call(this);
var guardGraphics = self.attachAsset('guard', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.update = function () {
// Guard movement logic will be handled in the game update loop
};
});
//<Assets used in the game will automatically appear here>
// Thief class
var Thief = Container.expand(function () {
var self = Container.call(this);
var thiefGraphics = self.attachAsset('thief', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
// Thief movement logic will be handled in the game update loop
};
});
// Trap class
var Trap = Container.expand(function () {
var self = Container.call(this);
var trapGraphics = self.attachAsset('trap', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Trap logic if needed
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
var thief = game.addChild(new Thief());
thief.x = 1024;
thief.y = 1366;
var cashItems = [];
var traps = [];
var guards = [];
var score = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
function spawnCash() {
var cash = new Cash();
cash.x = Math.random() * 2048;
cash.y = Math.random() * 2732;
cashItems.push(cash);
game.addChild(cash);
}
function spawnTrap() {
var trap = new Trap();
trap.x = Math.random() * 2048;
trap.y = Math.random() * 2732;
traps.push(trap);
game.addChild(trap);
}
function spawnGuard() {
var guard = new Guard();
guard.x = Math.random() * 2048;
guard.y = Math.random() * 2732;
guards.push(guard);
game.addChild(guard);
}
game.down = function (x, y, obj) {
thief.x = x;
thief.y = y;
};
game.update = function () {
for (var i = cashItems.length - 1; i >= 0; i--) {
if (thief.intersects(cashItems[i])) {
score += 10;
LK.setScore(score);
scoreTxt.setText(score);
cashItems[i].destroy();
cashItems.splice(i, 1);
}
}
for (var i = traps.length - 1; i >= 0; i--) {
if (thief.intersects(traps[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
for (var i = guards.length - 1; i >= 0; i--) {
if (thief.intersects(guards[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
if (LK.ticks % 120 == 0) {
spawnCash();
}
if (LK.ticks % 300 == 0) {
spawnTrap();
}
if (LK.ticks % 600 == 0) {
spawnGuard();
}
guards.forEach(function (guard) {
if (thief.x > guard.x) {
guard.x += guard.speed;
} else {
guard.x -= guard.speed;
}
if (thief.y > guard.y) {
guard.y += guard.speed;
} else {
guard.y -= guard.speed;
}
});
};
A security guard. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A stack of money. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A thief with a mask and steal bag. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A trap. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Powerup about cash. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.