User prompt
Make background
User prompt
Make enemies shoot less
User prompt
Please fix the bug: 'TypeError: score.getText2 is not a function' in or related to this line: 'score.setText2(parseInt(score.getText2()) + 100);' Line Number: 202
User prompt
Make game load faster
User prompt
Increase score chart on game by 50 when buĺlet by monster hit
User prompt
Please fix the bug: 'Uncaught ReferenceError: Score is not defined' in or related to this line: 'var score = game.addChild(new Score());' Line Number: 98
User prompt
Delete scorechart from gameover screen.
User prompt
Delete score chart
User prompt
Please fix the bug: 'TypeError: score.setText is not a function' in or related to this line: 'score.setText(parseInt(score.text) + 50);' Line Number: 154
User prompt
Please fix the bug: 'TypeError: score.getText is not a function' in or related to this line: 'score.setText(parseInt(score.getText()) + 50);' Line Number: 154
User prompt
Make orange block a player pic
User prompt
Increase score by 50 when enemy bullet hit
User prompt
Remove quit and play button
User prompt
Please fix the bug: 'Uncaught TypeError: LK.Text2 is not a constructor' in or related to this line: 'var quitButton = new LK.Text2('Quit', {' Line Number: 114
User prompt
Please fix the bug: 'Uncaught TypeError: LK.Text2 is not a constructor' in or related to this line: 'var playButton = new LK.Text2('Play', {' Line Number: 102
User prompt
Please fix the bug: 'Uncaught TypeError: LK.Container is not a constructor' in or related to this line: 'var homeScreen = new LK.Container();' Line Number: 101
User prompt
Make a home screen with a play button and a quit button when player opens game
User prompt
Display score on game over screen
User prompt
When monster hit, increase score on scoreboard by 100 points
User prompt
Please fix the bug: 'TypeError: score.getText2 is not a function' in or related to this line: 'score.setText2("Game Over. Your score is: " + parseInt(score.getText2()));' Line Number: 154
User prompt
When hit by 3 bullets shot by enemies, say game over and display score
User prompt
Make enemies bullets disappear when shot
User prompt
Make player lives times three
User prompt
Make enemies shoot bullets and decrease times of being hit by enemies
User prompt
Please fix the bug: 'TypeError: score.getText is not a function' in or related to this line: 'score.setText(parseInt(score.getText()) + 1);' Line Number: 144
/****
* Classes
****/
// Define the Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.update = function () {
self.y += self.speed;
};
});
var FieryBullet = Container.expand(function () {
var self = Container.call(this);
var fieryBulletGraphics = self.attachAsset('fieryBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.y -= self.speed;
};
});
// Define the Fire class
var Fire = Container.expand(function () {
var self = Container.call(this);
var fireGraphics = self.attachAsset('fire', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.y -= self.speed;
};
});
//<Assets used in the game will automatically appear here>
// Define the Player class
var Rocket = Container.expand(function () {
var self = Container.call(this);
var rocketGraphics = self.attachAsset('rocket', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 40;
self.update = function () {
// Rocket update logic
};
self.move = function (x, y) {
self.x = x;
self.y = y;
};
});
// Define the Score class
var Score = Container.expand(function () {
var self = Container.call(this);
var scoreGraphics = self.attachAsset('score', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Score update logic
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize player, target, fire, enemies, joystick and score
var rocket = game.addChild(new Rocket());
rocket.x = 2048 / 2;
rocket.y = 2732 - 200;
rocket.lives = 3; // Initialize rocket with 3 lives
var score = game.addChild(new Score());
score.x = 2048 / 2;
score.y = 50;
var fieryBullets = [];
var fire = game.addChild(new Fire());
fire.x = rocket.x;
fire.y = rocket.y;
var enemies = [];
for (var i = 0; i < 5; i++) {
var enemy = game.addChild(new Enemy());
enemy.x = Math.random() * 2048;
enemy.y = 0;
enemies.push(enemy);
}
// Handle player movement and fire breathing
game.down = function (x, y, obj) {
var dx = x - rocket.x;
var dy = y - rocket.y;
var angle = Math.atan2(dy, dx);
rocket.x += Math.cos(angle) * rocket.speed;
rocket.y += Math.sin(angle) * rocket.speed;
var newFieryBullet = new FieryBullet();
newFieryBullet.x = rocket.x;
newFieryBullet.y = rocket.y;
fieryBullets.push(newFieryBullet);
game.addChild(newFieryBullet);
};
// Check for win condition, player lives and enemy movement
game.update = function () {
if (rocket.lives <= 0) {
LK.showGameOver(); // Show game over when rocket has no more lives
}
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
if (enemy.y > 2732) {
enemy.y = 0;
enemy.x = Math.random() * 2048;
}
if (enemy.intersects(rocket)) {
rocket.lives--;
enemy.y = 0;
enemy.x = Math.random() * 2048;
}
for (var j = fieryBullets.length - 1; j >= 0; j--) {
var fieryBullet = fieryBullets[j];
if (fieryBullet.intersects(enemy)) {
enemy.destroy();
enemies.splice(i, 1);
fieryBullet.destroy();
fieryBullets.splice(j, 1);
// Increase the score by 1 each time an enemy is destroyed
score.setText2(parseInt(score.getText2()) + 1);
}
}
}
};
Red fiery bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Monster. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Rocket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Space scene that would be good for an app background. Single Game Texture. In-Game asset. 3d. Blank background. High contrast. No shadows.
Bullet dropping downward. Single Game Texture. In-Game asset. 3D. Blank background. High contrast. No shadows.