Code edit (1 edits merged)
Please save this source code
User prompt
implement sahape's attachLines()
Code edit (1 edits merged)
Please save this source code
User prompt
in shape attatch the polygon lines to the shape so that it moves
Code edit (1 edits merged)
Please save this source code
User prompt
make shape1 move
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: drawPolyGon is not defined' in or related to this line: 'self.polygon = drawPolyGon(coordinates); // Function to create a polygon from a list of coordinates' Line Number: 55
Code edit (1 edits merged)
Please save this source code
User prompt
in gameInitialize use shape instead of drawPolygon for shape1
User prompt
in shape take a list of coordinates
User prompt
create a new class Shape with properties polygon and speed
Code edit (1 edits merged)
Please save this source code
User prompt
make drawPolygon return the polygon
User prompt
make drawLine return the line object
User prompt
current exemple should draw a square but it's not, fix drawLine angle calculation when x2 < x1 or y2
User prompt
update the drawPolygon call
User prompt
update drawPolygon to take 4 coordinates {x: 100, y:100} instead
User prompt
use drawPolygon in gameInitialize()
User prompt
add a new utility function drawPolygon that takes 4 points coordinates and uses drawLine to draw the shape
Code edit (1 edits merged)
Please save this source code
User prompt
in gameInitialize, draw a line from 100,100 to 1024,1024
Code edit (1 edits merged)
Please save this source code
User prompt
add a new utility function drawLine(x1,y1,x2,y2)
User prompt
Add another parameter to Bullet class isTop
/**** 
* Classes
****/ 
// Bullet class for the spaceship.
var Bullet = Container.expand(function (isLeft, isTop) {
	var self = Container.call(this);
	self.isTop = isTop;
	var bulletGraphics = self.attachAsset('3D_bullet', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.isLeft = isLeft;
	self.speed = 10;
	self._move_migrated = function () {
		self.x += self.isLeft ? self.speed : -self.speed;
		self.y -= self.speed * 0.6;
		// Calculate distance to center and adjust width accordingly
		var distanceToCenter = Math.abs(self.x - 1024);
		var widthReduction = Math.max(0, (1 - distanceToCenter / 1024) * self.width);
		self.width = Math.max(5, self.width - widthReduction); // Ensure width does not go below 5
	};
});
// Cockpit representation class for the spaceship
var CockpitDisplay = Container.expand(function () {
	var self = Container.call(this);
	// Create a simple 2D representation of the ship's cockpit
	self.cockpitBase = self.attachAsset('flywheel', {
		anchorX: 0.5,
		anchorY: 0.5,
		// Anchor at the bottom center to simulate cockpit view
		scaleX: 1,
		// Scale down to fit within the screen appropriately
		scaleY: 1.5,
		y: 2732 - 400 // Position near the bottom of the screen
	});
	// Additional cockpit elements can be added here
});
// Enemy class removed as per task requirement.
// Assets will be automatically generated based on usage in the code.
// Player's spaceship class
var Spaceship = Container.expand(function () {
	var self = Container.call(this);
	var spaceshipGraphics = self.attachAsset('3D_spaceship', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.coords = {
		x: 0,
		y: 0,
		z: 0
	};
	self.speed = 0.01;
	self.shoot = function () {
		// Spawn bullets from side canons
		var leftBullet = new Bullet(true);
		leftBullet.x = 0; // Adjust for left canon position
		leftBullet.y = self.y + 512; // Start the bullet just above the spaceship
		leftBullet.rotation = Math.PI * 0.25;
		game.addChild(leftBullet);
		bullets.push(leftBullet);
		var rightBullet = new Bullet(false);
		rightBullet.x = game.width; // Adjust for right canon position
		rightBullet.y = self.y + 512; // Start the bullet just above the spaceship
		rightBullet.rotation = -Math.PI * 0.25;
		game.addChild(rightBullet);
		bullets.push(rightBullet);
		// Adding two more cannons
		var extraLeftBullet = new Bullet(true);
		extraLeftBullet.x = leftBullet.x + 100; // Slightly to the right of the left canon
		extraLeftBullet.y = self.y - 512; // Start the bullet just above the spaceship
		extraLeftBullet.rotation = Math.PI * 0.25;
		game.addChild(extraLeftBullet);
		bullets.push(extraLeftBullet);
		var extraRightBullet = new Bullet(false);
		extraRightBullet.x = rightBullet.x - 100; // Slightly to the left of the right canon
		extraRightBullet.y = self.y - 512; // Start the bullet just above the spaceship
		extraRightBullet.rotation = -Math.PI * 0.25;
		game.addChild(extraRightBullet);
		bullets.push(extraRightBullet);
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000 //Init game with black background
});
/**** 
* Game Code
****/ 
// Debug text to display current 3D space angles
var debugText = new Text2('Angles: 0, 0', {
	size: 50,
	fill: "#ffffff"
});
debugText.x = 10; // Position at top left
debugText.y = 10;
LK.gui.topLeft.addChild(debugText);
// Global object to hold the current horizontal and vertical angle in the 3D space
var current3DSpaceAngles = {
	horizontalAngle: 0,
	verticalAngle: 0,
	deltaH: 0,
	deltaV: 0
};
// Removed drag movement system
// Function to animate the star field for a dynamic background effect
function starFieldImageAnimation() {
	// TODO : Move starField background to go with current movement
}
function starFieldAnimation() {
	stars.forEach(function (star) {
		// Calculate direction vector from center to star
		var directionX = star.x - 1024; // 1024 is half the width of the screen
		var directionY = star.y - 1366; // 1366 is half the height of the screen
		// Normalize direction
		var length = Math.sqrt(directionX * directionX + directionY * directionY);
		if (length === 0) {
			// Prevent division by zero
			length = 1;
		}
		directionX /= length;
		directionY /= length;
		// Add offset based on current3DSpaceAngles
		directionX += current3DSpaceAngles.deltaH * 10; //.horizontalAngle;
		directionY += current3DSpaceAngles.deltaV * 10; //.verticalAngle;
		// Move star away from center
		// Increase star size as it moves away to simulate faster movement
		var sizeIncrease = Math.min(Math.abs(directionX * 2), Math.abs(directionY * 2));
		star.width = Math.min(20, star.width + sizeIncrease * 0.05); // Limit width to 20
		star.height = star.width;
		star.x += directionX * starsSpeed; // Increase speed to 10 for faster star movement
		star.y += directionY * starsSpeed;
		// Reset star position if it moves off screen
		if (star.x < 0 || star.x > 2048 || star.y < 0 || star.y > 2732) {
			star.x = Math.random() * 2048;
			star.y = Math.random() * 2732;
			star.width = Math.random() * 10; // Limit width to 20
			star.height = star.width; // Reset height to initial value
		}
	});
}
var nbStars = 80;
var starsSpeed = 10;
var stars = [];
for (var i = 0; i < nbStars; i++) {
	var star = LK.getAsset('star', {
		anchorX: 0.5,
		anchorY: 0.5,
		x: Math.random() * 2048,
		// Random position across the screen width
		y: Math.random() * 2732 // Random position across the screen height
	});
	stars.push(star);
	game.addChild(star);
}
// Add starField as an independent asset
var starField = LK.getAsset('starField', {
	anchorX: 0.0,
	anchorY: 0.0,
	scaleX: 1,
	scaleY: 1,
	x: 0,
	y: 0
});
var starField2 = LK.getAsset('starField2', {
	anchorX: 0.0,
	anchorY: 0.0,
	scaleX: 1,
	scaleY: 1,
	x: 0,
	y: 0
});
game.addChild(starField);
game.addChild(starField2);
starField.visible = false; // Initially hide the second starField
starField2.visible = false; // Initially hide the second starField
starField2.width = 2048 / 2; // Reset width to initial value
starField2.height = 2732 / 2; // Reset height to initial value
// White color for laser-like bullets
// Light Slate Gray for the spaceship
var spaceship = game.addChild(new Spaceship());
spaceship.x = 2048 / 2; // Center spaceship horizontally
spaceship.y = 2732 - spaceship.height / 2; // Position spaceship near the bottom of the screen
// Add the cockpit display to the game and rotate with ship X rotation
var cockpitDisplay = game.addChild(new CockpitDisplay());
cockpitDisplay.x = 2048 / 2; // Center cockpit display horizontally
var bullets = []; // Player's bullets
var enemies = [];
var rotationSpeed = 0.25;
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// Touch event to move and shoot
game.on('down', function (x, y, obj) {
	var touchPosition = game.toLocal(obj.global);
	console.log("touchPosition", touchPosition);
	if (touchPosition.x < game.width * 0.33) {
		// Pressing on the left side of the screen
		current3DSpaceAngles.deltaH += rotationSpeed; // Adjust horizontal angle to the left
	} else if (touchPosition.x > game.width * 0.66) {
		// Pressing on the right side of the screen
		current3DSpaceAngles.deltaH -= rotationSpeed; // Adjust horizontal angle to the right
	} else {
		console.log("centered");
		current3DSpaceAngles.deltaH = 0;
	}
	if (touchPosition.y < game.height * 0.33) {
		// Pressing on the upper half of the screen
		current3DSpaceAngles.deltaV += rotationSpeed; // Adjust vertical angle upwards
	} else if (touchPosition.y > game.height * 0.66) {
		// Pressing on the lower half of the screen
		current3DSpaceAngles.deltaV -= rotationSpeed; // Adjust vertical angle downwards
	} else {
		current3DSpaceAngles.deltaV = 0;
	}
	if (!current3DSpaceAngles.deltaH && !current3DSpaceAngles.deltaV) {
		spaceship.shoot();
	}
});
// Stop movement when user releases touch
game.on('up', function () {
	current3DSpaceAngles.deltaH = 0;
	current3DSpaceAngles.deltaV = 0;
});
// Enemy spawning logic removed as per task requirement.
// Game tick
LK.on('tick', function () {
	starFieldAnimation(); // Call the animation function within the game tick
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// Update spaceship coordinates and angles based on current3DSpaceAngles
	spaceship.coords.x += Math.sin(current3DSpaceAngles.horizontalAngle) * spaceship.speed;
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	spaceship.coords.y += Math.cos(current3DSpaceAngles.verticalAngle) * spaceship.speed;
	spaceship.coords.z += Math.sin(current3DSpaceAngles.verticalAngle) * Math.cos(current3DSpaceAngles.horizontalAngle) * spaceship.speed;
	// Move bullets
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i]._move_migrated();
		// Check if bullet reaches the center of the screen and destroy it
		//var distanceToCenter = Math.max(0, Math.min(1024, bullets[i].x - 1024));
		var distanceToCenter = bullets[i].isLeft ? 1024 - bullets[i].x : bullets[i].x - 1024;
		if (distanceToCenter <= 10) {
			// Assuming a small threshold around the center for destruction
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	// Update angles at a lower rate using modulo on ticks
	if (LK.ticks % 15 == 0) {
		current3DSpaceAngles.horizontalAngle += current3DSpaceAngles.deltaH;
		current3DSpaceAngles.verticalAngle += current3DSpaceAngles.deltaV;
	}
	// Move bullets
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i]._move_migrated();
		if (bullets[i].y < 0) {
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	// Rotate cockpitDisplay based on current3DSpaceAngles.horizontalAngle
	cockpitDisplay.cockpitBase.rotation += -current3DSpaceAngles.deltaH - cockpitDisplay.cockpitBase.rotation >= 0.02 ? 0.1 : 0;
	cockpitDisplay.cockpitBase.rotation += -current3DSpaceAngles.deltaH - cockpitDisplay.cockpitBase.rotation <= -0.02 ? -0.1 : 0;
	cockpitDisplay.cockpitBase.rotation = Math.min(Math.PI * 0.3, Math.max(-Math.PI * 0.3, cockpitDisplay.cockpitBase.rotation));
	cockpitDisplay.cockpitBase.scale.y = 1.5 + current3DSpaceAngles.deltaV * 0.5; // Illustrate vertical rotation by scaling the wheel
	debugText.setText('Coords: X=' + Math.round(spaceship.coords.x) + ', Y=' + Math.round(spaceship.coords.y) + ', Z=' + Math.round(spaceship.coords.z) + '\nAngles: H=' + Math.round(current3DSpaceAngles.horizontalAngle * (180 / Math.PI)) + '°, V=' + Math.round(current3DSpaceAngles.verticalAngle * (180 / Math.PI)) + '°');
}); /**** 
* Classes
****/ 
// Bullet class for the spaceship.
var Bullet = Container.expand(function (isLeft, isTop) {
	var self = Container.call(this);
	self.isTop = isTop;
	var bulletGraphics = self.attachAsset('3D_bullet', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.isLeft = isLeft;
	self.speed = 10;
	self._move_migrated = function () {
		self.x += self.isLeft ? self.speed : -self.speed;
		self.y -= self.speed * 0.6;
		// Calculate distance to center and adjust width accordingly
		var distanceToCenter = Math.abs(self.x - 1024);
		var widthReduction = Math.max(0, (1 - distanceToCenter / 1024) * self.width);
		self.width = Math.max(5, self.width - widthReduction); // Ensure width does not go below 5
	};
});
// Cockpit representation class for the spaceship
var CockpitDisplay = Container.expand(function () {
	var self = Container.call(this);
	// Create a simple 2D representation of the ship's cockpit
	self.cockpitBase = self.attachAsset('flywheel', {
		anchorX: 0.5,
		anchorY: 0.5,
		// Anchor at the bottom center to simulate cockpit view
		scaleX: 1,
		// Scale down to fit within the screen appropriately
		scaleY: 1.5,
		y: 2732 - 400 // Position near the bottom of the screen
	});
	// Additional cockpit elements can be added here
});
// Enemy class removed as per task requirement.
// Assets will be automatically generated based on usage in the code.
// Player's spaceship class
var Spaceship = Container.expand(function () {
	var self = Container.call(this);
	var spaceshipGraphics = self.attachAsset('3D_spaceship', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.coords = {
		x: 0,
		y: 0,
		z: 0
	};
	self.speed = 0.01;
	self.shoot = function () {
		// Spawn bullets from side canons
		var leftBullet = new Bullet(true);
		leftBullet.x = 0; // Adjust for left canon position
		leftBullet.y = self.y + 512; // Start the bullet just above the spaceship
		leftBullet.rotation = Math.PI * 0.25;
		game.addChild(leftBullet);
		bullets.push(leftBullet);
		var rightBullet = new Bullet(false);
		rightBullet.x = game.width; // Adjust for right canon position
		rightBullet.y = self.y + 512; // Start the bullet just above the spaceship
		rightBullet.rotation = -Math.PI * 0.25;
		game.addChild(rightBullet);
		bullets.push(rightBullet);
		// Adding two more cannons
		var extraLeftBullet = new Bullet(true);
		extraLeftBullet.x = leftBullet.x + 100; // Slightly to the right of the left canon
		extraLeftBullet.y = self.y - 512; // Start the bullet just above the spaceship
		extraLeftBullet.rotation = Math.PI * 0.25;
		game.addChild(extraLeftBullet);
		bullets.push(extraLeftBullet);
		var extraRightBullet = new Bullet(false);
		extraRightBullet.x = rightBullet.x - 100; // Slightly to the left of the right canon
		extraRightBullet.y = self.y - 512; // Start the bullet just above the spaceship
		extraRightBullet.rotation = -Math.PI * 0.25;
		game.addChild(extraRightBullet);
		bullets.push(extraRightBullet);
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000 //Init game with black background
});
/**** 
* Game Code
****/ 
// Debug text to display current 3D space angles
var debugText = new Text2('Angles: 0, 0', {
	size: 50,
	fill: "#ffffff"
});
debugText.x = 10; // Position at top left
debugText.y = 10;
LK.gui.topLeft.addChild(debugText);
// Global object to hold the current horizontal and vertical angle in the 3D space
var current3DSpaceAngles = {
	horizontalAngle: 0,
	verticalAngle: 0,
	deltaH: 0,
	deltaV: 0
};
// Removed drag movement system
// Function to animate the star field for a dynamic background effect
function starFieldImageAnimation() {
	// TODO : Move starField background to go with current movement
}
function starFieldAnimation() {
	stars.forEach(function (star) {
		// Calculate direction vector from center to star
		var directionX = star.x - 1024; // 1024 is half the width of the screen
		var directionY = star.y - 1366; // 1366 is half the height of the screen
		// Normalize direction
		var length = Math.sqrt(directionX * directionX + directionY * directionY);
		if (length === 0) {
			// Prevent division by zero
			length = 1;
		}
		directionX /= length;
		directionY /= length;
		// Add offset based on current3DSpaceAngles
		directionX += current3DSpaceAngles.deltaH * 10; //.horizontalAngle;
		directionY += current3DSpaceAngles.deltaV * 10; //.verticalAngle;
		// Move star away from center
		// Increase star size as it moves away to simulate faster movement
		var sizeIncrease = Math.min(Math.abs(directionX * 2), Math.abs(directionY * 2));
		star.width = Math.min(20, star.width + sizeIncrease * 0.05); // Limit width to 20
		star.height = star.width;
		star.x += directionX * starsSpeed; // Increase speed to 10 for faster star movement
		star.y += directionY * starsSpeed;
		// Reset star position if it moves off screen
		if (star.x < 0 || star.x > 2048 || star.y < 0 || star.y > 2732) {
			star.x = Math.random() * 2048;
			star.y = Math.random() * 2732;
			star.width = Math.random() * 10; // Limit width to 20
			star.height = star.width; // Reset height to initial value
		}
	});
}
var nbStars = 80;
var starsSpeed = 10;
var stars = [];
for (var i = 0; i < nbStars; i++) {
	var star = LK.getAsset('star', {
		anchorX: 0.5,
		anchorY: 0.5,
		x: Math.random() * 2048,
		// Random position across the screen width
		y: Math.random() * 2732 // Random position across the screen height
	});
	stars.push(star);
	game.addChild(star);
}
// Add starField as an independent asset
var starField = LK.getAsset('starField', {
	anchorX: 0.0,
	anchorY: 0.0,
	scaleX: 1,
	scaleY: 1,
	x: 0,
	y: 0
});
var starField2 = LK.getAsset('starField2', {
	anchorX: 0.0,
	anchorY: 0.0,
	scaleX: 1,
	scaleY: 1,
	x: 0,
	y: 0
});
game.addChild(starField);
game.addChild(starField2);
starField.visible = false; // Initially hide the second starField
starField2.visible = false; // Initially hide the second starField
starField2.width = 2048 / 2; // Reset width to initial value
starField2.height = 2732 / 2; // Reset height to initial value
// White color for laser-like bullets
// Light Slate Gray for the spaceship
var spaceship = game.addChild(new Spaceship());
spaceship.x = 2048 / 2; // Center spaceship horizontally
spaceship.y = 2732 - spaceship.height / 2; // Position spaceship near the bottom of the screen
// Add the cockpit display to the game and rotate with ship X rotation
var cockpitDisplay = game.addChild(new CockpitDisplay());
cockpitDisplay.x = 2048 / 2; // Center cockpit display horizontally
var bullets = []; // Player's bullets
var enemies = [];
var rotationSpeed = 0.25;
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// CONTINUER ICI : MAKE BLOCKS & CODE SEPARATORS
// Touch event to move and shoot
game.on('down', function (x, y, obj) {
	var touchPosition = game.toLocal(obj.global);
	console.log("touchPosition", touchPosition);
	if (touchPosition.x < game.width * 0.33) {
		// Pressing on the left side of the screen
		current3DSpaceAngles.deltaH += rotationSpeed; // Adjust horizontal angle to the left
	} else if (touchPosition.x > game.width * 0.66) {
		// Pressing on the right side of the screen
		current3DSpaceAngles.deltaH -= rotationSpeed; // Adjust horizontal angle to the right
	} else {
		console.log("centered");
		current3DSpaceAngles.deltaH = 0;
	}
	if (touchPosition.y < game.height * 0.33) {
		// Pressing on the upper half of the screen
		current3DSpaceAngles.deltaV += rotationSpeed; // Adjust vertical angle upwards
	} else if (touchPosition.y > game.height * 0.66) {
		// Pressing on the lower half of the screen
		current3DSpaceAngles.deltaV -= rotationSpeed; // Adjust vertical angle downwards
	} else {
		current3DSpaceAngles.deltaV = 0;
	}
	if (!current3DSpaceAngles.deltaH && !current3DSpaceAngles.deltaV) {
		spaceship.shoot();
	}
});
// Stop movement when user releases touch
game.on('up', function () {
	current3DSpaceAngles.deltaH = 0;
	current3DSpaceAngles.deltaV = 0;
});
// Enemy spawning logic removed as per task requirement.
// Game tick
LK.on('tick', function () {
	starFieldAnimation(); // Call the animation function within the game tick
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// CONTINUER ICI : MOVE IN FUNCTIONS
	// Update spaceship coordinates and angles based on current3DSpaceAngles
	spaceship.coords.x += Math.sin(current3DSpaceAngles.horizontalAngle) * spaceship.speed;
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	// CONTINUER ICI : FIX angleH = 180 MAIS Y NE PASSE PAS EN NEGATIF !!!
	spaceship.coords.y += Math.cos(current3DSpaceAngles.verticalAngle) * spaceship.speed;
	spaceship.coords.z += Math.sin(current3DSpaceAngles.verticalAngle) * Math.cos(current3DSpaceAngles.horizontalAngle) * spaceship.speed;
	// Move bullets
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i]._move_migrated();
		// Check if bullet reaches the center of the screen and destroy it
		//var distanceToCenter = Math.max(0, Math.min(1024, bullets[i].x - 1024));
		var distanceToCenter = bullets[i].isLeft ? 1024 - bullets[i].x : bullets[i].x - 1024;
		if (distanceToCenter <= 10) {
			// Assuming a small threshold around the center for destruction
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	// Update angles at a lower rate using modulo on ticks
	if (LK.ticks % 15 == 0) {
		current3DSpaceAngles.horizontalAngle += current3DSpaceAngles.deltaH;
		current3DSpaceAngles.verticalAngle += current3DSpaceAngles.deltaV;
	}
	// Move bullets
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i]._move_migrated();
		if (bullets[i].y < 0) {
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	// Rotate cockpitDisplay based on current3DSpaceAngles.horizontalAngle
	cockpitDisplay.cockpitBase.rotation += -current3DSpaceAngles.deltaH - cockpitDisplay.cockpitBase.rotation >= 0.02 ? 0.1 : 0;
	cockpitDisplay.cockpitBase.rotation += -current3DSpaceAngles.deltaH - cockpitDisplay.cockpitBase.rotation <= -0.02 ? -0.1 : 0;
	cockpitDisplay.cockpitBase.rotation = Math.min(Math.PI * 0.3, Math.max(-Math.PI * 0.3, cockpitDisplay.cockpitBase.rotation));
	cockpitDisplay.cockpitBase.scale.y = 1.5 + current3DSpaceAngles.deltaV * 0.5; // Illustrate vertical rotation by scaling the wheel
	debugText.setText('Coords: X=' + Math.round(spaceship.coords.x) + ', Y=' + Math.round(spaceship.coords.y) + ', Z=' + Math.round(spaceship.coords.z) + '\nAngles: H=' + Math.round(current3DSpaceAngles.horizontalAngle * (180 / Math.PI)) + '°, V=' + Math.round(current3DSpaceAngles.verticalAngle * (180 / Math.PI)) + '°');
});
 starfield.
 
 
 remove
 
 
 
 elongated futuristic laser canon gun green. top view
 
 explosion from top. zenith view
 
 
 white triangle.
 
 
 
 black background ethereal blue gas.
 
 black background ethereal centered galaxy.
 black background ethereal centered galaxy.
 black background ethereal centered planet.
 close up of a giant red star. black background
 planet with rings. black background. full, with margin.
 
 metalic oval border with bevel. Black. Electronic style. empty inside. no background
 
 
 
 
 
 
 futuristic space fighter.. full front view
 
 Space scene with full earth (europe and africa side). High definition
 elegant white rose in a long transparent futuristic glass tube.
 
 
 
 
 
 
 laserShot
Sound effect
bgMusic
Sound effect
explosion
Sound effect
laserShot2
Sound effect
detectionBeep1
Sound effect
fighterPassing
Sound effect
targetFoundBeep
Sound effect
damage
Sound effect
warning
Sound effect
startSound
Sound effect
acceleration
Sound effect
teamKill
Sound effect
finalExplosion
Sound effect