User prompt
сделать постоянные выстрелы
User prompt
пули стреляю всегда
User prompt
пули стреляю из начала самолета
User prompt
пули стреляю из правой части картинки в направлении движения самолета
User prompt
добавить выстрелы раз в секунду из правого края картинки самолета
User prompt
Subtract 3 degrees (in radians) for counter-clockwise rotation
User prompt
Subtract 5 degrees (in radians) for counter-clockwise rotation
User prompt
при нажатии и удерживании на экран изображение самолета вращается вокруг своей оси против часов стрелки. вращение изображения происходит от центра картинки на 1.5 градуса
User prompt
при нажатии и удерживании на экран изображение самолета вращается вокруг своей оси против часов стрелки. вращение изображения происходит от центра картинки
User prompt
вращение изображения против часов стрелки
User prompt
вращение изображения поменять на центр картинки
User prompt
Please fix the bug: 'ReferenceError: plane2 is not defined' in or related to this line: 'if (bullets[i].intersects(plane1) || bullets[i].intersects(plane2)) {' Line Number: 100
User prompt
при нажатии и удерживании на экран изображение самолета вращается вокруг своей оси
User prompt
при нажатии и удерживании на экран, на 1.5 градуса объект вращается вокруг своей оси против часовой стрелки
Code edit (1 edits merged)
Please save this source code
User prompt
исправить ошибку когда при нажатии на правую часть экрана не срабатывает изменение направления
User prompt
сделать задний фон белым
Code edit (3 edits merged)
Please save this source code
User prompt
исправить ошибку, когда смерть при соприкосновении с полом происходит за экраном
Code edit (1 edits merged)
Please save this source code
User prompt
изменение направление движения 1.5 градуса
User prompt
удалить plane2 из игры
User prompt
удалить самолет противника
User prompt
при сталкновении самолета с потолком или полом game over
User prompt
при сталкновении со стеной самолет появляется с другой стороны стены
/****
* Classes
****/
// Bullet class
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
width: 10,
height: 20,
color: 0xffffff,
shape: 'box'
});
self.speed = -10;
// Move bullet
self.move = function () {
self.y += self.speed;
};
});
// Assets are automatically created based on usage in the code.
// Plane class
var Plane = Container.expand(function () {
var self = Container.call(this);
// Initialize plane with a shape asset
var planeGraphics = self.attachAsset('plane', {
width: 60,
height: 60,
color: 0xff0000,
// Default red, will be overridden
shape: 'ellipse'
});
self.speedX = 0;
self.speedY = 0;
// Method to update plane position
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
// Make the plane appear on the opposite side of the screen when it hits a wall
if (self.x < 0) {
self.x = 2048;
} else if (self.x > 2048) {
self.x = 0;
}
if (self.y < 0) {
self.y = 2732;
} else if (self.y > 2732) {
self.y = 0;
}
};
// Method to shoot a bullet
self.shoot = function () {
var bullet = new Bullet();
bullet.x = self.x;
bullet.y = self.y;
bullets.push(bullet);
game.addChild(bullet);
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
var bullets = []; // Global array to keep track of bullets
// Create two planes
var plane1 = new Plane();
plane1.x = 200;
plane1.y = 200;
plane1.speedX = 5;
plane1.speedY = 3;
plane1.attachAsset('plane', {
color: 0x0000ff
}); // Blue color for plane1
var plane2 = new Plane();
plane2.x = 1848; // Start from the opposite side
plane2.y = 2532;
plane2.speedX = -5;
plane2.speedY = -3;
plane2.attachAsset('plane', {
color: 0xff0000
}); // Red color for plane2
// Add planes to the game
game.addChild(plane1);
game.addChild(plane2);
// Set up game tick
LK.on('tick', function () {
plane1.update();
plane2.update();
// Planes shoot bullets periodically
if (LK.ticks % 60 == 0) {
plane1.shoot();
plane2.shoot();
}
// Update and check bullets
for (var i = bullets.length - 1; i >= 0; i--) {
bullets[i].move();
// Check for bullet collision with planes
if (bullets[i].intersects(plane1) || bullets[i].intersects(plane2)) {
// For simplicity, just remove the bullet on collision
bullets[i].destroy();
bullets.splice(i, 1);
} else if (bullets[i].y < -50 || bullets[i].y > 2782) {
// Remove off-screen bullets
bullets[i].destroy();
bullets.splice(i, 1);
}
}
});
// Flags to track if the screen is being touched
var isTouchingLeft = false;
var isTouchingRight = false;
// Change plane direction when the screen is touched
game.on('down', function (obj) {
var pos = obj.event.getLocalPosition(game);
// If touch is on the left half of the screen, set isTouchingLeft to true
if (pos.x < 1024) {
isTouchingLeft = true;
} else {
// If touch is on the right half, set isTouchingRight to true
isTouchingRight = true;
}
});
// Stop changing plane direction when the screen is no longer being touched
game.on('up', function (obj) {
isTouchingLeft = false;
isTouchingRight = false;
});
// In the game tick, change plane direction while the screen is being touched
LK.on('tick', function () {
if (isTouchingLeft) {
var angle = Math.atan2(plane1.speedY, plane1.speedX);
angle -= Math.PI / 90; // Subtract 2 degrees (in radians) for counter-clockwise rotation
plane1.speedX = Math.cos(angle) * 5;
plane1.speedY = Math.sin(angle) * 5;
}
if (isTouchingRight) {
var angle = Math.atan2(plane2.speedY, plane2.speedX);
angle -= Math.PI / 90; // Subtract 2 degrees (in radians) for counter-clockwise rotation
plane2.speedX = Math.cos(angle) * 5;
plane2.speedY = Math.sin(angle) * 5;
}
});
снаряд от пушки. 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.
Нажатие по экрану. Палец. Мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.