User prompt
Make enemies bounce off walls of the screen.
User prompt
Please fix the bug: 'Uncaught TypeError: self.setBackgroundColor is not a function' in or related to this line: 'self.setBackgroundColor(0x00FF00); // Set background color to green' Line Number: 62
User prompt
Make the level board have a green background.
User prompt
Start the game at the level board.
User prompt
When the letters exit in the top right, in the top left hand corner, no wait, right hand corner, go to the level screen.
User prompt
Make speed power-ups look like a lightning bolt, with blue sheen.
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'speedBoost')' in or related to this line: 'enemies[e].speedBoost = false;' Line Number: 248
User prompt
if you get a speed power-up, you go faster. but if the enemy does, they get faster!
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 231
User prompt
make power-ups for speed that come up randomly in the level.
User prompt
When you click the exit button, make it go back to the level board.
User prompt
Make an exit button in the top left corner, no wait, the top right corner, yeah, the top right corner, which goes back to the level board in case you picked the wrong level.
User prompt
when clicking on a on a number in the level board it takes you to that level but but you start at level one and you have to get through all the levels to get to 20 and then and then you pass 20 and and then it just goes back to level board so then you can play whatever
User prompt
Please fix the bug: 'ReferenceError: player is not defined' in or related to this line: 'player.update();' Line Number: 142
User prompt
Make a level board where it's just fill all the levels from 1 to 20 and you have to go through a level then it goes back to the level board and then you choose the next level number 2 and then that thing same thing happens in number 3 and so on and Once you finish number 20, then if you get the
User prompt
Every 10 enemies you hit, it goes up to the next level. If you go, once you go up to a new level, then it increases the number of enemies you have to defeat by 10.
User prompt
and if it gets the game over function it set the background to green just plain green and then if you click play again it resets it to the game screen
User prompt
Add 20 levels to make the player go through all the levels up and up until it gets to the 20, then it goes into the You Win screen, and in the levels, the number of enemies increases which each level has to deal with. If you want to make the player go through all the levels up and up until it gets to the 20, then it goes into the You Win screen, and in the levels, the number of enemies increases
User prompt
make the player exactly follow the mouse
User prompt
make the player a square which follows the mouse
User prompt
make it so that the player can shoot enemy sprites to pervent them from getting hit.
Initial prompt
test
/**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -15; self.update = function () { self.y += self.speed; if (self.y < 0) { self.destroy(); } }; }); // 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 = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); //<Assets used in the game will automatically appear here> // Define the Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Player update logic }; self.move = function (x, y) { self.x = x; self.y = y; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize player var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 200; // Initialize enemies array var enemies = []; // Initialize bullets array var bullets = []; // Handle player movement game.move = function (x, y, obj) { player.move(x, y); }; // Handle shooting game.down = function (x, y, obj) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); game.addChild(bullet); }; // Game update loop game.update = function () { // Update player player.update(); // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].update(); if (enemies[i].intersects(player)) { LK.showGameOver(); } } // Update bullets for (var j = bullets.length - 1; j >= 0; j--) { bullets[j].update(); for (var k = enemies.length - 1; k >= 0; k--) { if (bullets[j].intersects(enemies[k])) { bullets[j].destroy(); enemies[k].destroy(); bullets.splice(j, 1); enemies.splice(k, 1); break; } } } // Spawn enemies if (LK.ticks % 60 == 0) { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 0; enemies.push(enemy); game.addChild(enemy); } };
===================================================================
--- original.js
+++ change.js
@@ -1,65 +1,64 @@
-/****
+/****
* Classes
-****/
-// Define the Bullet class
+****/
var Bullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('bullet', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = -15;
- self.update = function () {
- self.y += self.speed;
- if (self.y < 0) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -15;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y < 0) {
+ self.destroy();
+ }
+ };
});
// 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 = 5;
- self.update = function () {
- self.y += self.speed;
- if (self.y > 2732) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var enemyGraphics = self.attachAsset('enemy', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
});
//<Assets used in the game will automatically appear here>
// Define the Player class
var Player = Container.expand(function () {
- var self = Container.call(this);
- var playerGraphics = self.attachAsset('player', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 10;
- self.update = function () {
- // Player update logic
- };
- self.move = function (x, y) {
- self.x = x;
- self.y = y;
- };
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 10;
+ self.update = function () {
+ // Player update logic
+ };
+ self.move = function (x, y) {
+ self.x = x;
+ self.y = y;
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize player
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
@@ -68,47 +67,47 @@
// Initialize bullets array
var bullets = [];
// Handle player movement
game.move = function (x, y, obj) {
- player.move(x, y);
+ player.move(x, y);
};
// Handle shooting
game.down = function (x, y, obj) {
- var bullet = new Bullet();
- bullet.x = player.x;
- bullet.y = player.y;
- bullets.push(bullet);
- game.addChild(bullet);
+ var bullet = new Bullet();
+ bullet.x = player.x;
+ bullet.y = player.y;
+ bullets.push(bullet);
+ game.addChild(bullet);
};
// Game update loop
game.update = function () {
- // Update player
- player.update();
- // Update enemies
- for (var i = enemies.length - 1; i >= 0; i--) {
- enemies[i].update();
- if (enemies[i].intersects(player)) {
- LK.showGameOver();
- }
- }
- // Update bullets
- for (var j = bullets.length - 1; j >= 0; j--) {
- bullets[j].update();
- for (var k = enemies.length - 1; k >= 0; k--) {
- if (bullets[j].intersects(enemies[k])) {
- bullets[j].destroy();
- enemies[k].destroy();
- bullets.splice(j, 1);
- enemies.splice(k, 1);
- break;
- }
- }
- }
- // Spawn enemies
- if (LK.ticks % 60 == 0) {
- var enemy = new Enemy();
- enemy.x = Math.random() * 2048;
- enemy.y = 0;
- enemies.push(enemy);
- game.addChild(enemy);
- }
+ // Update player
+ player.update();
+ // Update enemies
+ for (var i = enemies.length - 1; i >= 0; i--) {
+ enemies[i].update();
+ if (enemies[i].intersects(player)) {
+ LK.showGameOver();
+ }
+ }
+ // Update bullets
+ for (var j = bullets.length - 1; j >= 0; j--) {
+ bullets[j].update();
+ for (var k = enemies.length - 1; k >= 0; k--) {
+ if (bullets[j].intersects(enemies[k])) {
+ bullets[j].destroy();
+ enemies[k].destroy();
+ bullets.splice(j, 1);
+ enemies.splice(k, 1);
+ break;
+ }
+ }
+ }
+ // Spawn enemies
+ if (LK.ticks % 60 == 0) {
+ var enemy = new Enemy();
+ enemy.x = Math.random() * 2048;
+ enemy.y = 0;
+ enemies.push(enemy);
+ game.addChild(enemy);
+ }
};
\ No newline at end of file