Code edit (1 edits merged)
Please save this source code
User prompt
spawn tube faster not velocity i want tube spawn earlier
Code edit (12 edits merged)
Please save this source code
User prompt
vaz geçtim ekranın ortasının biraz sağına gelince tree spawn olsun
User prompt
tree tube ekranın tam ortasına geldiğinde değilde biraz soluna geldiğinde spawn olsun azıcık ekranın ortasının soluna gelince
Code edit (3 edits merged)
Please save this source code
User prompt
make them 1.2 time faster
User prompt
make them 1.5 time faster
Code edit (2 edits merged)
Please save this source code
User prompt
tube ve tree nin velocitysini eşit düzeyde arttır
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
spawn 1 tree after 1 second tube spawned
User prompt
create only 1 tree
User prompt
the gap between two trees are 2.1 second
User prompt
and make another tree spawn 2 second later
User prompt
spawn tree 1 second after tube spawned
User prompt
make tree 10 time faster and keep the velocity of tube same
User prompt
always keep the velocity of tube same and increase the velocity of tree 5 time faster
User prompt
make şt 5 time faster
User prompt
increase the velocity of tree
User prompt
create tree asset when tube reaches middle of the screen
User prompt
make tree touch to bottom of the screen all the time when spawning,make velocity of tree same as tube
User prompt
make tree asset spawn on the right of the screen,give a random height between 400 to 3800 ,make width 300, when tube reaches middle of the screen spawn tree
User prompt
lower the velocity of tube and increase velocity of tree
/**** * Classes ****/ //<Write imports for supported plugins here> // Character class with gravity and jump functionality var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.velocityY = 0; self.gravity = 0.3; self.jumpStrength = -12; self.update = function () { self.velocityY += self.gravity; self.y += self.velocityY; // Prevent character from falling through the ground if (self.y > 2732 - 100) { self.y = 2732 - 100; self.velocityY = 0; } }; self.jump = function () { // Allow jump even if in the air self.velocityY = self.jumpStrength; }; }); // Tube class with a medium velocity moving to the left and spawning on top and bottom var Tube = Container.expand(function () { var self = Container.call(this); var tubeGraphics = self.attachAsset('tube', { anchorX: 0.5, anchorY: 0.5, width: 300, height: Math.floor(Math.random() * (4200 - 400 + 1)) + 400 }); self.velocityX = -1; self.update = function () { if (self.x < -300) { self.x = 2048 + 100; tubeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600; } self.x += self.velocityX; // Respawn tube on the right side of the screen when it goes off the left side if (self.x < -200) { self.x = 2048 + 200; // Spawn tube only on the bottom self.y = 2732 - 150; // Change tube height to random values between 4200 and 400 tubeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Create and position the character in the middle of the screen // Initialize assets used in this game. var character = game.addChild(new Character()); character.x = 2048 / 2; character.y = 2732 / 2; // Create and position the sky in the center of the screen var sky = LK.getAsset('sky', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, tint: 0x000000 // Change color to black }); game.addChildAt(sky, 0); // Create and position the background in the center of the screen var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChildAt(background, 1); // Create and position the ground at the bottom of the screen var ground = LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 5 }); game.addChild(ground); // Create and position the tree asset on the right side of the screen var tree = game.addChild(new Tube()); tree.x = 2048 + 50; tree.y = Math.floor(Math.random() * (3800 - 400 + 1)) + 400; // Handle touch events to make the character jump game.down = function (x, y, obj) { character.jump(); character.rotation = 0.1; // Reduce the rotation to the right LK.setTimeout(function () { character.rotation = 0; }, 200); }; // Update game state every tick game.update = function () { character.update(); for (var i = 0; i < 10; i++) { tree.update(); // When the tree reaches the middle of the screen, spawn a new tree if (tree.x <= 2048 / 2) { tree = game.addChild(new Tube()); tree.x = 2048 + 50; tree.y = Math.floor(Math.random() * (3800 - 400 + 1)) + 400; } } };
===================================================================
--- original.js
+++ change.js
@@ -25,44 +25,18 @@
// Allow jump even if in the air
self.velocityY = self.jumpStrength;
};
});
-// Tree class with the same functionality as the Tube class
-var Tree = Container.expand(function () {
- var self = Container.call(this);
- var treeGraphics = self.attachAsset('tree', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 300,
- height: Math.floor(Math.random() * (4200 - 400 + 1)) + 400
- });
- self.velocityX = -4;
- self.update = function () {
- if (self.x < -300) {
- self.x = 2048 + 100;
- treeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600;
- }
- self.x += self.velocityX;
- // Respawn tree on the right side of the screen when it goes off the left side
- if (self.x < -200) {
- self.x = 2048 + 200;
- // Spawn tree only on the bottom
- self.y = 2732 - 150;
- // Change tree height to random values between 4200 and 400
- treeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600;
- }
- };
-});
-// Tube class with the same functionality as the Tree class
+// Tube class with a medium velocity moving to the left and spawning on top and bottom
var Tube = Container.expand(function () {
var self = Container.call(this);
var tubeGraphics = self.attachAsset('tube', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: Math.floor(Math.random() * (4200 - 400 + 1)) + 400
});
- self.velocityX = -2;
+ self.velocityX = -1;
self.update = function () {
if (self.x < -300) {
self.x = 2048 + 100;
tubeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600;
@@ -118,12 +92,12 @@
x: 2048 / 2,
y: 2732 - 5
});
game.addChild(ground);
-// Create and position the tube off the right side of the screen
-var tube = game.addChild(new Tube());
-tube.x = 2048 + 50;
-tube.y = 2732 - 150;
+// Create and position the tree asset on the right side of the screen
+var tree = game.addChild(new Tube());
+tree.x = 2048 + 50;
+tree.y = Math.floor(Math.random() * (3800 - 400 + 1)) + 400;
// Handle touch events to make the character jump
game.down = function (x, y, obj) {
character.jump();
character.rotation = 0.1; // Reduce the rotation to the right
@@ -134,13 +108,13 @@
// Update game state every tick
game.update = function () {
character.update();
for (var i = 0; i < 10; i++) {
- tube.update();
- // Spawn a tree when the tube reaches the middle of the screen
- if (tube.x === 2048 / 2) {
- var tree = game.addChild(new Tree());
+ tree.update();
+ // When the tree reaches the middle of the screen, spawn a new tree
+ if (tree.x <= 2048 / 2) {
+ tree = game.addChild(new Tube());
tree.x = 2048 + 50;
- tree.y = 2732 - 150;
+ tree.y = Math.floor(Math.random() * (3800 - 400 + 1)) + 400;
}
}
};
\ No newline at end of file
green theme forest by green tones to the sky , not to much detail just simple tree shadows trees has no details just shadowed green and shadowless places, beautiful view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
hyper realistic nature too reallistic proffational blue sky white clouds yellow sun an over realistic mountain view with full of trees and sun and clouds view a forest of a mountain challangeing mountain road. No background.cool background. view background. No shadows. 2d. In-Game asset. flat