Code edit (2 edits merged)
Please save this source code
User prompt
Particles should start behind fhe hero and move downwards
User prompt
make sure engine particles dissapear when hero moves back
User prompt
on game start move hero 500 pixels to the front in 2 seconds and then back to the start position, where it will stay for the rest of the game.
User prompt
start spawning engine particles the moment the game starts
User prompt
on game start move hero 500 pixels to the front in 2 seconds and then back to the start position, where it will stay for the rest of the game.
User prompt
on game start move hero 500 pixels to the front in 2 seconds, and then back 500 pixels in 2 seconds
User prompt
start of game hero should move 400 pixels to the front and 1 second later 400 pixels to the back
User prompt
rotate engine particles 90 degrees
User prompt
Fix Bug: 'ReferenceError: particles is not defined' in this line: 'particles.forEach(function (particle, index) {' Line Number: 235
User prompt
Fix Bug: 'ReferenceError: particles is not defined' in this line: 'particles.forEach(function (particle, index) {' Line Number: 235
Code edit (1 edits merged)
Please save this source code
User prompt
reduce engine paarticles to 10
User prompt
decrease ammount of engine particles progressible
User prompt
destroy engine paticles when not in use
User prompt
less engine particles
User prompt
show engineparticles behing hero
Code edit (1 edits merged)
Please save this source code
User prompt
show engine particles
User prompt
spawn engine particles behing hero on game start
User prompt
spawn energyparticles below hero
User prompt
show eneryparticles on tick
User prompt
spawn energyparticles behing hero
User prompt
show energyparticles behing hero. not a lot. keep it performant.
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'x')' in this line: 'engineParticle.x = hero.x;' Line Number: 136
var EngineParticle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.createAsset('engineParticle', 'Engine Particle Graphics', 0.5, 0.5);
particleGraphics.rotation = Math.random() * Math.PI * 2;
particleGraphics.blendMode = 1;
self.speed = 20;
self.move = function () {
self.y += self.speed;
self.alpha -= 0.03;
if (self.alpha <= 0) self.destroy();
};
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.createAsset('cloud', 'Cloud Graphics', 0.5, 0.5);
self.speedY = 1;
self.move = function () {
var cloudSpeed = 0.5;
self.y += cloudSpeed;
if (self.y > 2732) {
self.y = -cloudGraphics.height;
}
};
});
var HeroBullet = Container.expand(function (hero) {
var self = Container.call(this);
var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5);
self.speed = -3;
self.damage = 1;
self.move = function () {
self.x += self.speedX * self.scale.x * self.scale.x;
self.y += self.speedY * self.scale.y * self.scale.y;
self.rotation = hero.rotation + Math.PI / 2;
self.damage = self.scale.x * self.scale.y;
};
});
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5);
self.speed = 3;
self.move = function () {
self.y += self.speed;
};
});
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
self.movementDirection = 1;
self.movementSpeed = 0.5;
self.movementRange = 50;
self.originalX = 2048 / 2;
self.x = self.originalX;
self.updateMovement = function () {
self.x += self.movementDirection * self.movementSpeed;
if (self.x < self.originalX - self.movementRange || self.x > self.originalX + self.movementRange) {
self.movementDirection *= -1;
}
};
});
var Enemy = Container.expand(function (hero) {
var self = Container.call(this);
var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5);
self.speedY = 2;
self.hero = hero;
self.lifebar = self.createAsset('lifebar', 'Enemy Lifebar', .5, 0);
self.lifebar.y = -self.lifebar.height - 100;
self.life = 100;
self.move = function () {
var dx = this.hero.x - this.x;
var dy = this.hero.y - this.y;
var angle = Math.atan2(dy, dx);
var speedMultiplier = 1 + Math.floor(LK.ticks / 7200);
self.x += (Math.cos(angle) * self.speedY + Math.sin(LK.ticks / 60) * 5) * speedMultiplier;
self.y += Math.sin(angle) * self.speedY * speedMultiplier;
self.lifebar.scale.x = self.life / 100;
};
});
var ScrollingBackground = Container.expand(function () {
var self = Container.call(this);
self.secondBackground = self.createAsset('background', 'Second Game Background', 0, 0);
self.secondBackground.width = 2048;
self.secondBackground.height = 2732 * 2;
self.secondBackground.y = -2732;
var backgroundGraphics = self.createAsset('background', 'Game Background', 0, 0);
backgroundGraphics.width = 2048;
backgroundGraphics.height = 2732 * 2;
self.y = -2732;
self.scroll = function () {
var backgroundSpeed = 1 + Math.floor(LK.ticks / 7200);
self.y += backgroundSpeed;
if (self.y >= 0) {
self.y = -2732;
}
if (self.secondBackground) {
self.secondBackground.y += backgroundSpeed;
if (self.secondBackground.y >= 0) {
self.secondBackground.y = -2732;
}
}
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var enemies = [];
self.spawnEnemy = function () {
var enemy = new Enemy(hero);
enemy.x = Math.random() * 2048;
enemy.y = -enemy.height;
enemies.push(enemy);
self.addChild(enemy);
};
var enemySpawnTicker = 0;
LK.on('tick', function () {
scrollingBackground.scroll();
var spawnRate = Math.max(30, 120 - Math.floor(LK.ticks / 3600));
if (enemySpawnTicker++ % spawnRate === 0) {
self.spawnEnemy();
}
});
var scrollingBackground = self.addChildAt(new ScrollingBackground(), 0);
stage.on('up', function (obj) {
if (currentBullet) {
var pos = obj.event.getLocalPosition(self);
var dx = pos.x - hero.x;
var dy = pos.y - hero.y;
var angle = Math.atan2(dy, dx);
currentBullet.speedX = Math.cos(angle) * 15;
currentBullet.speedY = Math.sin(angle) * 15;
hero.rotation = angle;
heroBullets.push(currentBullet);
currentBullet = null;
}
});
LK.on('tick', function () {
hero.updateMovement();
for (var i = 0; i < 5; i++) {
var engineParticle = new EngineParticle();
self.addChild(engineParticle);
engineParticle.x = hero.x;
engineParticle.y = hero.y + hero.height / 2;
}
for (var i = 0; i < 5; i++) {
var engineParticle = new EngineParticle();
engineParticle.x = hero.x;
engineParticle.y = hero.y + hero.height / 2;
self.addChild(engineParticle);
engineParticle.move();
}
if (currentBullet) {
var holdDuration = LK.ticks - holdTime;
var sizeMultiplier = Math.max(1, 1 + Math.abs(Math.sin(holdDuration / 60)) * 3);
currentBullet.scale.x = sizeMultiplier;
currentBullet.scale.y = sizeMultiplier;
currentBullet.rotation = hero.rotation;
}
});
var currentBullet = null;
var holdTime = 0;
var hero;
hero = self.addChild(new Hero());
hero.rotation = -Math.PI / 2;
stage.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
var dx = pos.x - hero.x;
var dy = pos.y - hero.y;
var angle = Math.atan2(dy, dx);
hero.rotation = angle;
currentBullet = new HeroBullet(hero);
currentBullet.x = hero.x;
currentBullet.y = hero.y - hero.height / 2 - currentBullet.height / 2 - 10;
currentBullet.rotation = hero.rotation;
self.addChild(currentBullet);
holdTime = LK.ticks;
});
stage.on('move', function (obj) {
var pos = obj.event.getLocalPosition(self);
var dx = pos.x - hero.x;
var dy = pos.y - hero.y;
var angle = Math.atan2(dy, dx);
hero.rotation = angle;
});
var enemies = [];
var heroBullets = [];
var enemyBullets = [];
var clouds = [];
for (var i = 0; i < 5; i++) {
var cloud = new Cloud();
cloud.x = Math.random() * 2048;
cloud.y = Math.random() * -2732;
clouds.push(cloud);
self.addChildAt(cloud, 1);
}
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff",
dropShadow: true,
dropShadowColor: "#000000",
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6
});
LK.gui.topCenter.addChild(scoreTxt);
var isGameOver = false;
hero.x = 2048 / 2;
hero.y = 2732 - 280;
LK.on('tick', function () {
for (var i = 0; i < heroBullets.length; i++) {
heroBullets[i].move();
for (var j = 0; j < enemies.length; j++) {
if (heroBullets[i].intersects(enemies[j])) {
enemies[j].life -= heroBullets[i].damage * 10;
if (enemies[j].life <= 0) {
var scoreIncrement = 10 + Math.floor(LK.ticks / 3600);
LK.setScore(LK.getScore() + scoreIncrement);
scoreTxt.setText(LK.getScore().toString());
enemies[j].destroy();
enemies.splice(j, 1);
}
heroBullets[i].destroy();
heroBullets.splice(i, 1);
break;
}
}
if (heroBullets[i] && heroBullets[i].y < -50) {
heroBullets[i].destroy();
heroBullets.splice(i, 1);
}
}
for (var i = 0; i < enemyBullets.length; i++) {
enemyBullets[i].move();
if (enemyBullets[i].y > 2732 + 50) {
enemyBullets[i].destroy();
enemyBullets.splice(i, 1);
}
}
for (var i = 0; i < enemies.length; i++) {
if (enemies[i].intersects(hero)) {
isGameOver = true;
break;
}
}
for (var i = 0; i < enemies.length; i++) {
enemies[i].move();
if (enemies[i].y > 2732) {
enemies[i].destroy();
enemies.splice(i, 1);
i--;
}
}
clouds.forEach(function (cloud) {
cloud.move();
});
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
});
Goku arms doing kamehameha. seen from above. 8-bit. Cartoon. In game asset. No shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. Cartoon. Orange energy ball. . In game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
rotate image 45 degrees
8-bit. cartoon. white energy ball. gradieint. transparent. in game asset. flicker. shoot. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. front view. flying final boss. white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.