User prompt
the enemy gigles a bit ups and down on their axes
User prompt
add wiggle to the enemy
User prompt
if the enemy is moving to the left the enemy aster stays as it is. if the enemy is moving to the right the image is inverted.
User prompt
when the enemy is moving from left to right the image is facing right. When the enemy is looking right to left the enemy image is facing left
User prompt
if the enemy is moving from left to right the image is inverted
User prompt
the enemy moves slightly up and down.
User prompt
add wiggle movement to the enemy
User prompt
make the enemy move faster x2
User prompt
the player is in the bottom middle of the screen
User prompt
the enemies apear within the border of the screen
User prompt
on the game starts there are three anemies on the screen in diferent postions
User prompt
move the score icon and the score under the counter
User prompt
move the scoreIcon 20 pizels up
User prompt
15 pixels up
User prompt
move the score icon 20 pixels up
User prompt
move the score icon down 120 pixels
User prompt
move the score icon down 20 mixels
User prompt
put the score and the score icon under the counter the icon is before the score, the score is on the right or the icon, the icon and the score are on the same line and height
User prompt
the score icon is on the same line and height with the score
User prompt
the score is within the screen
User prompt
once the player collides with the enemy the enemy disappears and the score is updated. Every enemy gives you 5 points
User prompt
make the player a bit bigger. x3
User prompt
add a player that can move around the screen
User prompt
add three enemies. The enemies appear at random places on the scree. They move from right to left , from left to right or diagonally. once the enemy exits the screen they are deleted.
User prompt
fix the bug
/**** * Classes ****/ var ScoreCounter = Container.expand(function () { var self = Container.call(this); var score = 0; var scoreIcon = self.createAsset('scoreIcon', 'Score Icon', 0, 0.5); scoreIcon.y += 100; var scoreText = new Text2(score.toString(), { size: 150, fill: '#ffffff', align: 'left' }); scoreText.x = scoreIcon.width + 10; scoreText.y = 0; self.addChild(scoreIcon); self.addChild(scoreText); self.updateScore = function (newScore) { score = newScore; scoreText.setText(score.toString()); }; }); var Timer = Container.expand(function () { var self = Container.call(this); var timeLeft = 120; var timerText = new Text2(timeLeft.toString(), { size: 150, fill: '#ffffff' }); self.addChild(timerText); timerText.setText(timeLeft); self.update = function () { if (timeLeft > 0) { timeLeft -= 1 / 60; timerText.setText(Math.ceil(timeLeft)); } else { LK.showGameOver(); } }; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy Graphics', 0.5, 0.5); self.direction = Math.random() < 0.5 ? 1 : -1; self.diagonal = Math.random() < 0.33; self.speed = 2 + Math.random() * 3; self.move = function () { self.x += self.speed * self.direction; if (self.diagonal) { self.y += self.speed * (Math.random() < 0.5 ? 1 : -1); } if (self.x < -enemyGraphics.width || self.x > 2048 + enemyGraphics.width || self.y < -enemyGraphics.height || self.y > 2732 + enemyGraphics.height) { self.destroy(); } }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player Graphics', 0.5, 0.5); playerGraphics.scale.set(3); self.speed = 5; self.move = function (direction) { switch (direction) { case 'left': self.x -= self.speed; break; case 'right': self.x += self.speed; break; case 'up': self.y -= self.speed; break; case 'down': self.y += self.speed; break; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var playerInstance = game.addChild(new Player()); playerInstance.x = game.width / 2; playerInstance.y = game.height - playerInstance.height / 2 - 15; LK.on('tick', function () { timerInstance.update(); scoreCounterInstance.updateScore(LK.getScore()); }); var enemies = []; LK.on('tick', function () { timerInstance.update(); scoreCounterInstance.updateScore(LK.getScore()); manageEnemies(); }); function manageEnemies() { if (LK.ticks % 120 === 0) { var newEnemy = new Enemy(); newEnemy.x = Math.random() < 0.5 ? -50 : 2048 + 50; newEnemy.y = Math.random() * 2732; enemies.push(newEnemy); game.addChild(newEnemy); } for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].move(); if (playerInstance.intersects(enemies[i])) { LK.setScore(LK.getScore() + 5); scoreCounterInstance.updateScore(LK.getScore()); enemies[i].destroy(); enemies.splice(i, 1); } else if (!enemies[i].parent) { enemies.splice(i, 1); } } } var dragNode = null; function handleMove(obj) { var event = obj.event; var pos = event.getLocalPosition(game); if (dragNode) { dragNode.x = pos.x; dragNode.y = pos.y; } } game.on('move', handleMove); game.on('down', function (obj) { dragNode = playerInstance; handleMove(obj); }); game.on('up', function (obj) { dragNode = null; }); var timerInstance = game.addChild(new Timer()); timerInstance.x = game.width - timerInstance.width - 20; timerInstance.y = 20; var scoreCounterInstance = game.addChild(new ScoreCounter()); scoreCounterInstance.x = 20; scoreCounterInstance.y = 20; game.addChild(scoreCounterInstance);
===================================================================
--- original.js
+++ change.js
@@ -4,9 +4,9 @@
var ScoreCounter = Container.expand(function () {
var self = Container.call(this);
var score = 0;
var scoreIcon = self.createAsset('scoreIcon', 'Score Icon', 0, 0.5);
- scoreIcon.y += 120;
+ scoreIcon.y += 100;
var scoreText = new Text2(score.toString(), {
size: 150,
fill: '#ffffff',
align: 'left'
pixel butterfly. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel butterfly looking left, showing the left profile. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Remove it and make it transparent
pixel sunny field height is bigger than width.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.