User prompt
the button when clicked, subtracts 100 points from the score at the too and reduces the bullet cool-down by 0.25 seconds
User prompt
Add a new button class is on the bottom left corner of the screen that when clicked, subtracts 100 points from the score at the too and reduces the bullet cool-down by 0.25 seconds
User prompt
can we add a new button but when you click it it subtracts 100 points from your score but it subtracts 0.25 seconds from the bullet cooldown so you can fire faster
User prompt
chance the bullet cool down to 1 second
User prompt
can we add a charging function so when you shoot a bullet if you hold it, it slowly gets biger
User prompt
can you make the weaker monster switch from monster 1 to monster 2 to monster 3 to monster 4
User prompt
Fix Bug: 'TypeError: self.monsterGraphics.setTexture is not a function' in or related to this line: 'self.monsterGraphics.setTexture(LK.getAsset('monster_walk' + (self.currentFrameIndex + 1), {}).texture);' Line Number: 141
User prompt
Fix Bug: 'TypeError: self.monsterGraphics.setTexture is not a function' in or related to this line: 'self.monsterGraphics.setTexture(LK.getAsset('monster_walk' + (self.currentFrameIndex + 1), {' Line Number: 141
User prompt
Fix Bug: 'TypeError: self.monsterGraphics.setTexture is not a function' in or related to this line: 'self.monsterGraphics.setTexture(LK.getAsset('monster_walk' + (self.currentFrameIndex + 1), {}));' Line Number: 141
User prompt
Fix Bug: 'TypeError: self.monsterGraphics.setTexture is not a function' in or related to this line: 'self.monsterGraphics.setTexture('monster_walk' + (self.currentFrameIndex + 1));' Line Number: 141
User prompt
Fix Bug: 'TypeError: self.monsterGraphics.setTexture is not a function' in or related to this line: 'self.monsterGraphics.setTexture('monster_walk' + (self.currentFrameIndex + 1));' Line Number: 158
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
User prompt
Fix Bug: 'TypeError: Converting circular structure to JSON --> starting at object with constructor 't.DisplayObjectContainer' | property 'children' -> object with constructor 'Array' | index 0 -> object with constructor 't.Graphics' --- property 'parent' closes the circle' in or related to this line: 'var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {' Line Number: 138
/****
* Classes
****/
var Hero = Container.expand(function () {
var self = Container.call(this);
self.update = function () {
if (self.shootTimer > 0) {
self.shootTimer--;
}
};
self.destroyMonsters = function () {
monsters.forEach(function (monster) {
monster.destroy();
});
monsters.length = 0;
LK.setScore(LK.getScore() + monsters.length);
};
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.move = function (direction) {
if (direction === 'left') {
self.x -= self.speed;
}
if (direction === 'right') {
self.x += self.speed;
}
if (direction === 'up') {
self.y -= self.speed;
}
if (direction === 'down') {
self.y += self.speed;
}
};
self.shootCooldown = 120; // 2 seconds at 60FPS
self.shootTimer = 0;
self.shoot = function () {
if (self.shootTimer <= 0) {
var bullet = new Bullet();
bullet.x = self.x;
bullet.y = self.y;
game.addChild(bullet);
self.shootTimer = self.shootCooldown;
return bullet;
}
return null;
};
});
var StrongerMonster = Container.expand(function () {
var self = Container.call(this);
var monsterGraphics = self.attachAsset('strongMonster', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 5;
self.speed = 2;
self.hit = false;
self.hitTimer = 0;
self.update = function () {
if (self.hit) {
self.hitTimer--;
if (self.hitTimer <= 0) {
self.hit = false;
}
}
};
self.moveTowards = function (targetX, targetY) {
var dx = targetX - self.x;
var dy = targetY - self.y;
var angle = Math.atan2(dy, dx);
var newX = self.x + Math.cos(angle) * self.speed;
var newY = self.y + Math.sin(angle) * self.speed;
if (!self.hit) {
self.x = newX;
self.y = newY;
}
};
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.move = function () {
self.y -= self.speed;
};
});
var Door = Container.expand(function () {
var self = Container.call(this);
var doorGraphics = self.attachAsset('door', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 / 2;
self.y = 128;
});
var WeakerMonster = Container.expand(function () {
var self = Container.call(this);
self.animationFrames = [LK.getAsset('monster_walk1', {
width: 200,
height: 242.05,
id: 'monster_walk1_id'
}), LK.getAsset('monster_walk2', {
width: 200,
height: 242.05,
id: 'monster_walk2_id'
}), LK.getAsset('monster_walk3', {
width: 200,
height: 242.05,
id: 'monster_walk3_id'
}), LK.getAsset('monster_walk4', {
width: 200,
height: 242.05,
id: 'monster_walk4_id'
})];
self.currentFrame = 0;
self.frameCounter = 0;
self.frameChangeRate = 15; // Change frame every 15 ticks (1/4 second at 60FPS)
var monsterGraphics = self.attachAsset(self.animationFrames[self.currentFrame], {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 2;
self.speed = 2;
self.hit = false;
self.hitTimer = 0;
self.update = function () {
if (self.hit) {
self.hitTimer--;
if (self.hitTimer <= 0) {
self.hit = false;
}
}
// Handle walking animation
self.frameCounter++;
if (self.frameCounter >= self.frameChangeRate) {
self.currentFrame = (self.currentFrame + 1) % self.animationFrames.length;
self.removeChild(monsterGraphics);
monsterGraphics = self.animationFrames[self.currentFrame];
self.addChild(monsterGraphics);
self.frameCounter = 0;
}
};
self.moveTowards = function (targetX, targetY) {
var dx = targetX - self.x;
var dy = targetY - self.y;
var angle = Math.atan2(dy, dx);
var newX = self.x + Math.cos(angle) * self.speed;
var newY = self.y + Math.sin(angle) * self.speed;
if (!self.hit) {
self.x = newX;
self.y = newY;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game();
/****
* Game Code
****/
// Score bar at the top
var scoreBar = new Text2('0', {
size: 150,
fill: "#ffffff",
anchorX: 0.5,
anchorY: 0
});
LK.gui.top.addChild(scoreBar);
var background = game.attachAsset('stoneBrickFloor', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
var hero = game.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 / 2;
// Add keyboard event listeners for arrow key movement and space for destroying monsters
LK.on('keydown', function (obj) {
var event = obj.event;
switch (event.key) {
case 'ArrowLeft':
hero.move('left');
break;
case 'ArrowRight':
hero.move('right');
break;
case 'ArrowUp':
hero.move('up');
break;
case 'ArrowDown':
hero.move('down');
break;
case ' ':
// Space key
hero.destroyMonsters();
break;
}
});
var door = game.addChild(new Door());
var monsters = [];
var bullets = [];
game.on('up', function (obj) {
bullets.push(hero.shoot());
});
LK.on('tick', function () {
// Increment score every second
if (LK.ticks % 60 === 0) {
LK.setScore(LK.getScore() + 1);
scoreBar.setText(LK.getScore().toString());
}
hero.update();
var spawnRate = LK.getScore() >= 80 ? 300 : LK.getScore() >= 50 ? 360 : 420;
var spawnWeakCounter = 0;
var spawnStrong = false;
var strongMonsterExists = false;
var spawnDelayTimer = 0;
var spawnDelayDuration = 300; // 5 seconds at 60FPS
if (strongMonsterExists) {
var strongMonster = monsters.find(function (monster) {
return monster instanceof StrongerMonster;
});
if (!strongMonster) {
strongMonsterExists = false;
spawnDelayTimer = spawnDelayDuration;
}
}
if (spawnDelayTimer > 0) {
spawnDelayTimer--;
} else if (spawnWeakCounter < 4 && LK.ticks % spawnRate === 0) {
var monster = new WeakerMonster();
monster.x = door.x;
monster.y = door.y;
monsters.push(monster);
game.addChild(monster);
spawnWeakCounter++;
} else if (spawnWeakCounter >= 4 && !strongMonsterExists && spawnDelayTimer === 0) {
var strongMonster = new StrongerMonster();
strongMonster.x = door.x;
strongMonster.y = door.y;
monsters.push(strongMonster);
game.addChild(strongMonster);
strongMonsterExists = true;
spawnWeakCounter = 0;
}
monsters.forEach(function (monster, index) {
monster.update();
monster.moveTowards(hero.x, hero.y);
if (monster.intersects(hero)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
if (monster instanceof StrongerMonster && monster.health <= 0) {
strongMonsterExists = false;
}
});
bullets.forEach(function (bullet, index) {
if (bullet) {
bullet.move();
}
if (bullet && bullet.y < 0) {
bullet.destroy();
bullets.splice(index, 1);
} else {
monsters.forEach(function (monster, mIndex) {
if (bullet && bullet.intersects(monster)) {
monster.health -= 1;
monster.hit = true;
monster.hitTimer = 30; // 0.5 seconds at 60FPS
if (monster.health <= 0) {
monster.destroy();
monsters.splice(mIndex, 1);
LK.setScore(LK.getScore() + 1);
}
bullet.destroy();
bullets.splice(index, 1);
}
});
}
});
});
wooden door thats round at the top 8 bit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
wisard 8 bit from the top down. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tentacle monster 8 bit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit tentacle monster. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit stone brick dungeon floor with a tiny amount of moss with tinny little bricks and very low contrast make it darker to. Single Game Texture. In-Game asset. 2d. Blank background.. No shadows.
8 bit fireball with a flame trail that goes down. Single Game Texture. In-Game asset. 2d. Blank background.. No shadows.
just move the tentacles a tinny litle bit
make the monster move
green button 8 bit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.