User prompt
The hero is currently moving upward every frame. Make the hero only move when dragged
User prompt
When the hero spawns a bullet, create a bullet asset at the location of the hero and make the bullet move upward every frame
User prompt
When the enemy spawns a bullet, create a bullet asset at the location of the enemy and make the bullet move downward every frame
User prompt
When the hero spawns a bullet, create a bullet asset at the location of the hero and make it move upward every frame
User prompt
Make background scroll and loop
User prompt
Create Bullet asset
User prompt
Hero shoots bullets constantly
User prompt
Background image
User prompt
Enemies come from the top of the screen. Enemies shoot beams
User prompt
Troubleshoot code
User prompt
Hero plane continuously shoots
User prompt
Waves of enemies come from top of the screen. Limit to 20 enemies on screen at one time
User prompt
Player has full control to move the hero plane
Initial prompt
Sky Wars
var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero Plane', .5, .5); self.speed = 5; self.move = function () {}; self.fire = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy Plane', .5, .5); self.speed = -3; self.move = function () { self.y += self.speed; }; self.fire = function () { var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y; bullet.move = function () { bullet.y += bullet.speed; }; enemyBullets.push(bullet); self.parent.addChild(bullet); }; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', .5, .5); self.speed = 10; self.move = function () { self.y -= self.speed; }; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet', .5, .5); self.speed = -7; self.move = function () { self.y += self.speed; }; }); var Game = Container.expand(function () { var self = Container.call(this); var bg = self.createAsset('background', 'Background Image', 0, 0); bg.width = 2048; bg.height = 2732; var bg2 = self.createAsset('background', 'Background Image', 0, 0); bg2.width = 2048; bg2.height = 2732; bg2.y = -2732; var hero = self.addChild(new Hero()); var enemies = []; var heroBullets = []; var enemyBullets = []; hero.x = 2048 / 2; hero.y = 2732 - 200; var spawnEnemy = function () { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 0; enemies.push(enemy); self.addChild(enemy); }; var spawnHeroBullet = function () { var bullet = new HeroBullet(); bullet.x = hero.x; bullet.y = hero.y; bullet.move = function () { bullet.y -= bullet.speed; }; heroBullets.push(bullet); self.addChild(bullet); }; var spawnEnemyBullet = function () {}; var checkCollision = function () {}; var gameOver = function () {}; LK.on('tick', function () { bg.y += 2; bg2.y += 2; if (bg.y >= 2732) bg.y = -2732; if (bg2.y >= 2732) bg2.y = -2732; hero.move(); enemies.forEach(function (enemy, index) { enemy.move(); if (LK.ticks % 60 === 0) { enemy.fire(); } if (enemy.y > 2732) { enemy.destroy(); enemies.splice(index, 1); } }); heroBullets.forEach(function (bullet, index) { bullet.move(); if (bullet.y < 0) { bullet.destroy(); heroBullets.splice(index, 1); } }); enemyBullets.forEach(function (bullet) { bullet.move(); }); checkCollision(); }); LK.on('tick', function () { if (LK.ticks % 30 === 0) { spawnHeroBullet(); } }); var dragHero = null; stage.on('down', function (obj) { dragHero = hero; }); stage.on('move', function (obj) { if (dragHero) { var pos = obj.event.getLocalPosition(self); dragHero.x = pos.x; dragHero.y = pos.y; } }); stage.on('up', function (obj) { dragHero = null; }); });
===================================================================
--- original.js
+++ change.js
@@ -1,11 +1,9 @@
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero Plane', .5, .5);
self.speed = 5;
- self.move = function () {
- self.y -= self.speed;
- };
+ self.move = function () {};
self.fire = function () {};
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
Futuristic fighter plane, chrono trigger, top down view, behind Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Special item shooting game pixel art, shiny Single Game Texture. In-Game asset. 2d. Blank background.
Top down shooter, alien space enemy craft, retro pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bright yellow blast pixel art shooter game Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
65604d9e9017209915d71b35: Top down shooter, alien space enemy craft, retro pixel art, red flying space alien, giant eye ball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
65604d9e9017209915d71b35: Top down shooter, alien space craft enemy craft, retro pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art bullet blue and white shining orb of energy retro Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art top down aerial view barren desert, sand dunes, retro shooter Single Game Texture. In-Game asset. 2d. Blank background. Low contrast. No shadows.
hit point heart pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art explosion, retro Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.