Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Add the astronaut to the scene
Code edit (1 edits merged)
Please save this source code
User prompt
add the background graphics to the game, before the moon is added.
User prompt
create a fullscreen background image
User prompt
Add a round moon oibject in center of screen
Initial prompt
Lunar Javelin Throw
===================================================================
--- original.js
+++ change.js
@@ -1,71 +1,71 @@
-/****
+/****
* Classes
-****/
+****/
// Assets will be automatically generated based on usage in the code.
// Javelin class
var Javelin = Container.expand(function () {
- var self = Container.call(this);
- var javelinGraphics = self.attachAsset('javelin', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speedX = 0;
- self.speedY = 0;
- self.gravity = 0.1; // Simulate low gravity on the moon
- self.move = function () {
- self.x += self.speedX;
- self.y += self.speedY;
- self.speedY += self.gravity; // Apply gravity effect
- };
+ var self = Container.call(this);
+ var javelinGraphics = self.attachAsset('javelin', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speedX = 0;
+ self.speedY = 0;
+ self.gravity = 0.1; // Simulate low gravity on the moon
+ self.move = function () {
+ self.x += self.speedX;
+ self.y += self.speedY;
+ self.speedY += self.gravity; // Apply gravity effect
+ };
});
// Moon surface class for visual effect
var MoonSurface = Container.expand(function () {
- var self = Container.call(this);
- var surfaceGraphics = self.attachAsset('moonSurface', {
- anchorX: 0.5,
- anchorY: 1.0 // Anchor at the bottom
- });
- self.x = 1024; // Center horizontally
- self.y = 2732; // Position at the bottom of the screen
+ var self = Container.call(this);
+ var surfaceGraphics = self.attachAsset('moonSurface', {
+ anchorX: 0.5,
+ anchorY: 1.0 // Anchor at the bottom
+ });
+ self.x = 1024; // Center horizontally
+ self.y = 1366; // Position at the center of the screen
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Init game with black background
+ backgroundColor: 0x000000 // Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize important variables and arrays
var javelins = [];
var moonSurface = game.addChild(new MoonSurface());
// Create a method to launch a javelin
function launchJavelin() {
- var javelin = new Javelin();
- javelin.x = 1024; // Launch from center horizontally
- javelin.y = 2500; // Launch from near the bottom
- javelin.speedX = Math.random() * 10 - 5; // Random horizontal speed
- javelin.speedY = -10 - Math.random() * 5; // Upward speed with a little randomness
- javelins.push(javelin);
- game.addChild(javelin);
+ var javelin = new Javelin();
+ javelin.x = 1024; // Launch from center horizontally
+ javelin.y = 2500; // Launch from near the bottom
+ javelin.speedX = Math.random() * 10 - 5; // Random horizontal speed
+ javelin.speedY = -10 - Math.random() * 5; // Upward speed with a little randomness
+ javelins.push(javelin);
+ game.addChild(javelin);
}
// Touch event to launch a javelin
game.on('down', function (obj) {
- launchJavelin();
+ launchJavelin();
});
// Game tick event
LK.on('tick', function () {
- // Move each javelin
- for (var i = javelins.length - 1; i >= 0; i--) {
- javelins[i].move();
- // Remove javelins that have fallen off the screen
- if (javelins[i].y > 2732) {
- javelins[i].destroy();
- javelins.splice(i, 1);
- }
- }
+ // Move each javelin
+ for (var i = javelins.length - 1; i >= 0; i--) {
+ javelins[i].move();
+ // Remove javelins that have fallen off the screen
+ if (javelins[i].y > 2732) {
+ javelins[i].destroy();
+ javelins.splice(i, 1);
+ }
+ }
});
// Note: The game automatically handles game over, score, and other UI elements.
\ No newline at end of file
pixelart. a beautiful moon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart a beautiful starry sky seen in empty outer space.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. a javelin used for olympic games and athletics. Just the spear itself, horizontally laid out in the image. It should be a slim metal spear, pointy in both ends, and with a grip somewhere off center of the shaft.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. a metallic triangular pointer.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart lettering of the word 'LUNAR' with some blank space around it.
replace inpainted area with transparency.
pixelart. asteroid with craters. subtle shading.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. asteroid with craters. subtle shading.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small light yellow star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
delete the inpainted areas.
Pixelart. A background window for an in-game shop, with a space theme. The center part should be a large blank area with space for the items and labels for sale in the game shop. The blank space could have the form of a black computer screen inside a spaceship.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixelart. An icon of a an arm holding javelin with fire around it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Turn in-painted area solid blue like the area around it.
Pixelart. A rectangular silvery button with the text 'CLOSE'.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.