User prompt
Сделай секундомер сверху экрана
User prompt
Сделай так чтоб при столкновении героя и врага игра заканчивалась
User prompt
Сделай так чтоб при попадание в врага пули героя враг умирал
User prompt
Сделай чтоб враги игрока таранили а не стреляли
User prompt
Уменьш скорострельность врага на минимум
User prompt
И уменьши скорость атаки
User prompt
Замедли появление врагов
Initial prompt
Выживания в космосе
/**** * Classes ****/ // Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Hero update logic }; self.shoot = function () { // Hero shooting logic }; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Enemy update logic }; self.shoot = function () { // Enemy shooting logic }; }); // Bullet class for hero var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('heroBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -10; self.move = function () { self.y += self.speed; }; }); // Bullet class for enemies var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.move = function () { self.y += self.speed; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize hero // Define assets for the hero, enemies, and bullets var hero = game.addChild(new Hero()); hero.x = 2048 / 2; hero.y = 2732 - 150; // Initialize enemies and bullets arrays var enemies = []; var heroBullets = []; var enemyBullets = []; // Game tick event LK.on('tick', function () { // Update hero hero.update(); // Update all enemies for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].update(); // Check for enemy off-screen or collision with hero bullets if (enemies[i].y > 2732 || enemies[i].intersects(hero)) { enemies[i].destroy(); enemies.splice(i, 1); } } // Update all hero bullets for (var j = heroBullets.length - 1; j >= 0; j--) { heroBullets[j].move(); // Check for bullet off-screen if (heroBullets[j].y < 0) { heroBullets[j].destroy(); heroBullets.splice(j, 1); } } // Update all enemy bullets for (var k = enemyBullets.length - 1; k >= 0; k--) { enemyBullets[k].move(); // Check for bullet off-screen or collision with hero if (enemyBullets[k].y > 2732 || enemyBullets[k].intersects(hero)) { enemyBullets[k].destroy(); enemyBullets.splice(k, 1); } } // Hero shooting logic if (LK.ticks % 30 == 0) { var bullet = new HeroBullet(); bullet.x = hero.x; bullet.y = hero.y; heroBullets.push(bullet); game.addChild(bullet); } // Enemy spawning logic if (LK.ticks % 120 == 0) { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = -100; enemies.push(enemy); game.addChild(enemy); } // Enemy shooting logic enemies.forEach(function (enemy) { if (Math.random() < 0.05) { var bullet = new EnemyBullet(); bullet.x = enemy.x; bullet.y = enemy.y; enemyBullets.push(bullet); game.addChild(bullet); } }); }); // Touch event handling for hero movement game.on('down', function (obj) { var touchPos = obj.event.getLocalPosition(game); hero.x = touchPos.x; hero.y = touchPos.y; }); game.on('move', function (obj) { if (obj.event.target === hero) { var touchPos = obj.event.getLocalPosition(game); hero.x = touchPos.x; hero.y = touchPos.y; } }); game.on('up', function (obj) { // Stop moving the hero when touch ends });
/****
* Classes
****/
// Hero class
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Hero update logic
};
self.shoot = function () {
// Hero shooting logic
};
});
// Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Enemy update logic
};
self.shoot = function () {
// Enemy shooting logic
};
});
// Bullet class for hero
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('heroBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -10;
self.move = function () {
self.y += self.speed;
};
});
// Bullet class for enemies
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('enemyBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
// Initialize hero
// Define assets for the hero, enemies, and bullets
var hero = game.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 - 150;
// Initialize enemies and bullets arrays
var enemies = [];
var heroBullets = [];
var enemyBullets = [];
// Game tick event
LK.on('tick', function () {
// Update hero
hero.update();
// Update all enemies
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].update();
// Check for enemy off-screen or collision with hero bullets
if (enemies[i].y > 2732 || enemies[i].intersects(hero)) {
enemies[i].destroy();
enemies.splice(i, 1);
}
}
// Update all hero bullets
for (var j = heroBullets.length - 1; j >= 0; j--) {
heroBullets[j].move();
// Check for bullet off-screen
if (heroBullets[j].y < 0) {
heroBullets[j].destroy();
heroBullets.splice(j, 1);
}
}
// Update all enemy bullets
for (var k = enemyBullets.length - 1; k >= 0; k--) {
enemyBullets[k].move();
// Check for bullet off-screen or collision with hero
if (enemyBullets[k].y > 2732 || enemyBullets[k].intersects(hero)) {
enemyBullets[k].destroy();
enemyBullets.splice(k, 1);
}
}
// Hero shooting logic
if (LK.ticks % 30 == 0) {
var bullet = new HeroBullet();
bullet.x = hero.x;
bullet.y = hero.y;
heroBullets.push(bullet);
game.addChild(bullet);
}
// Enemy spawning logic
if (LK.ticks % 120 == 0) {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = -100;
enemies.push(enemy);
game.addChild(enemy);
}
// Enemy shooting logic
enemies.forEach(function (enemy) {
if (Math.random() < 0.05) {
var bullet = new EnemyBullet();
bullet.x = enemy.x;
bullet.y = enemy.y;
enemyBullets.push(bullet);
game.addChild(bullet);
}
});
});
// Touch event handling for hero movement
game.on('down', function (obj) {
var touchPos = obj.event.getLocalPosition(game);
hero.x = touchPos.x;
hero.y = touchPos.y;
});
game.on('move', function (obj) {
if (obj.event.target === hero) {
var touchPos = obj.event.getLocalPosition(game);
hero.x = touchPos.x;
hero.y = touchPos.y;
}
});
game.on('up', function (obj) {
// Stop moving the hero when touch ends
});
Космолет с оружием и видом с верху. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Космический булыжниклетящий и круживщейся вокруг своей оси С видом с верха. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Космический патрон смотрящий прямо. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.