User prompt
Make score chart
User prompt
Make enemies disappear when shot
User prompt
Increase player speed by a bunch
User prompt
Make player move faster
User prompt
Make enemy lives decrease by 1 live when hit
User prompt
Make enemies at top of game
User prompt
Delete lightblue block
User prompt
Delete light blue block
User prompt
Please fix the bug: 'ReferenceError: target is not defined' in or related to this line: 'if (fire.intersects(target)) {' Line Number: 136
User prompt
Make blue blocks bad guys
User prompt
Please fix the bug: 'ReferenceError: player is not defined' in or related to this line: 'if (player.intersects(target)) {' Line Number: 118
User prompt
Please fix the bug: 'Uncaught ReferenceError: player is not defined' in or related to this line: 'fire.x = player.x;' Line Number: 97
User prompt
Make a rocket that shoots red fiery bullets
User prompt
Make player have 3 lives
User prompt
Make joystick for player
User prompt
Make a fire breathing monster
Initial prompt
Creeper99iscool
===================================================================
--- original.js
+++ change.js
@@ -1,59 +1,80 @@
-/****
+/****
* Classes
-****/
+****/
+// 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 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;
+ };
});
// Define the Target class
var Target = Container.expand(function () {
- var self = Container.call(this);
- var targetGraphics = self.attachAsset('target', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.update = function () {
- // Target update logic
- };
+ var self = Container.call(this);
+ var targetGraphics = self.attachAsset('target', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ // Target update logic
+ };
});
-/****
+/****
* 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 and target
+****/
+// Initialize player, target and fire
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
var target = game.addChild(new Target());
target.x = Math.random() * 2048;
target.y = Math.random() * 2732;
-// Handle player movement
+var fire = game.addChild(new Fire());
+fire.x = player.x;
+fire.y = player.y;
+// Handle player movement and fire breathing
game.down = function (x, y, obj) {
- player.move(x, y);
+ player.move(x, y);
+ fire.x = player.x;
+ fire.y = player.y;
};
// Check for win condition
game.update = function () {
- if (player.intersects(target)) {
- LK.showGameOver();
- }
+ if (player.intersects(target)) {
+ LK.showGameOver();
+ }
+ if (fire.intersects(target)) {
+ target.x = Math.random() * 2048;
+ target.y = Math.random() * 2732;
+ }
};
\ No newline at end of file
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.