User prompt
make the screen egg-white
User prompt
Make the screen b64f2c color
User prompt
Make the screen off-white
User prompt
Make the screen white and the chicken text black
User prompt
Change the text 'Score: 0' to 'Chicken'.
User prompt
delete the enemy class
User prompt
Delete the bullet class
User prompt
delete the dots
Initial prompt
Chicken
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Chicken class var Chicken = Container.expand(function () { var self = Container.call(this); var chickenGraphics = self.attachAsset('chicken', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Update logic for chicken }; 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 variables var chicken; var score = 0; var scoreTxt; // Initialize game elements function initGame() { chicken = game.addChild(new Chicken()); chicken.x = 2048 / 2; chicken.y = 2732 - 200; scoreTxt = new Text2('Score: 0', { size: 100, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); } // Update game elements game.update = function () { chicken.update(); }; // Handle touch events game.down = function (x, y, obj) { chicken.move(x, y); }; game.move = function (x, y, obj) { chicken.move(x, y); }; game.up = function (x, y, obj) { // No action needed on touch up }; // Initialize the game initGame();
===================================================================
--- original.js
+++ change.js
@@ -17,24 +17,8 @@
self.x = x;
self.y = y;
};
});
-// 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 = 3;
- self.update = function () {
- self.y += self.speed;
- if (self.y > 2732) {
- self.y = -self.height;
- self.x = Math.random() * 2048;
- }
- };
-});
/****
* Initialize Game
****/
@@ -46,22 +30,15 @@
* Game Code
****/
// Initialize variables
var chicken;
-var enemies = [];
var score = 0;
var scoreTxt;
// Initialize game elements
function initGame() {
chicken = game.addChild(new Chicken());
chicken.x = 2048 / 2;
chicken.y = 2732 - 200;
- for (var i = 0; i < 5; i++) {
- var enemy = game.addChild(new Enemy());
- enemy.x = Math.random() * 2048;
- enemy.y = Math.random() * -2732;
- enemies.push(enemy);
- }
scoreTxt = new Text2('Score: 0', {
size: 100,
fill: "#ffffff"
});
@@ -70,15 +47,8 @@
}
// Update game elements
game.update = function () {
chicken.update();
- enemies.forEach(function (enemy) {
- enemy.update();
- if (chicken.intersects(enemy)) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- });
};
// Handle touch events
game.down = function (x, y, obj) {
chicken.move(x, y);