User prompt
on game start power ups should start ascending
User prompt
spawn power ups coming down up in the same line as the player
User prompt
make circle 50% transparent
User prompt
Please fix the bug: 'Uncaught TypeError: Graphics is not a constructor' in or related to this line: 'var circle = new Graphics();' Line Number: 18
User prompt
add a circle arround the player
User prompt
Add player in the center of the screen
Initial prompt
Empty game
/**** * Classes ****/ // Create a player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Add a circle around the player var circle = self.attachAsset('circle', { anchorX: 0.5, anchorY: 0.5, alpha: 0.5 }); }); // Create a PowerUp class var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); // Set powerUp speed self.speed = 5; // This is automatically called every game tick, if the powerUp is attached! self.update = function () { self.y -= self.speed; }; }); /**** * Initialize Game ****/ // Add player to the game //<Assets used in the game will automatically appear here> //<Write entity 'classes' with empty functions for important behavior here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Add player to the game // Keep track of powerUps using an array var powerUps = []; // Spawn powerUps every 60 game ticks if (LK.ticks % 60 == 0) { var newPowerUp = new PowerUp(); newPowerUp.x = player.x; newPowerUp.y = 0; powerUps.push(newPowerUp); game.addChild(newPowerUp); } var player = game.addChild(new Player()); player.x = 2048 / 2; // Center player horizontally player.y = 2732 / 2; // Center player vertically
===================================================================
--- original.js
+++ change.js
@@ -25,9 +25,9 @@
// Set powerUp speed
self.speed = 5;
// This is automatically called every game tick, if the powerUp is attached!
self.update = function () {
- self.y += self.speed;
+ self.y -= self.speed;
};
});
/****