User prompt
Let the image of background2 can pass the top and bottom edges of the screen when i scroll it by scrollbutton
Code edit (3 edits merged)
Please save this source code
User prompt
Add speed for the background2 and for the scrollbutton
User prompt
Add the scrollbar to the game again
User prompt
Add scrolling for the scrollbar
User prompt
Start moveing the background2 up if i drag the scrollbutton down
User prompt
make the scrollbutton be inside the scrollbar
User prompt
Move the scrollbutton to the top right corner
Code edit (1 edits merged)
Please save this source code
User prompt
Add scrolling for the background2 by scrollbutton to scroll vertically on the scrollbar, with limit of it's vertical movment is the top and buttom edges of the scrollbar
User prompt
Set the scrollbutton position in the middle of scrollbar
User prompt
Please fix the bug: 'scrollbar is not defined' in or related to this line: 'scrollbutton.y = scrollbar.height / 2 - scrollbutton.height / 2;' Line Number: 68
User prompt
remove scroll from scrollbar
User prompt
Remove the drag for the scrollbutton
User prompt
Let the button can scroll the background2 up and down
User prompt
Remove movement in exact same time with the cursor for the scrollbutton
User prompt
set the limit for the movment of the scrollbutton is the top and buttom edges of the scrollbar.
User prompt
Reorder the background2 image to be behind scrollbar and scrollbutton images
User prompt
reorder the background1 image to be behind all images
User prompt
reorder the background2 image to be behind scrollbar image
User prompt
reorder the background2 to be before the scrollbutton in the screen
User prompt
Reorder the scrollbar to be after the scrollbutton in the screen
User prompt
Please fix the bug: 'Uncaught ReferenceError: tween is not defined' in or related to this line: 'tween(this, {' Line Number: 90 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add tween plugin to let the cursor move the scrollbutton vertically in same time. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Reposition the scrollbutton to be in the middle of the scrollbar
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var scrollbar = LK.getAsset('scrollbar', { anchorX: 1.0, anchorY: 0.0, x: 2048, y: 0 }); scrollbar.x = 2048 - scrollbar.width; scrollbar.y = 0; game.addChild(scrollbar); var scrollbutton = LK.getAsset('scrollbutton', { anchorX: 1.0, anchorY: 0.0, x: 2048, y: 0 }); scrollbutton.x = 2048 - scrollbutton.width; scrollbutton.y = scrollbar.height / 2 - scrollbutton.height / 2; game.addChild(scrollbutton); scrollbutton.down = function (x, y, obj) { this.dragging = true; this.data = obj; this.alpha = 0.5; this.dragPoint = game.toLocal(obj.global, this); }; var background1 = LK.getAsset('background1', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); game.addChildAt(background1, 0); scrollbutton.move = function (x, y, obj) { if (this.dragging) { var newPosition = game.toLocal(this.data.global, this.parent); tween(this, { y: newPosition.y - this.dragPoint.y }, { duration: 300, easing: tween.easeInOut }); tween(background2, { y: this.y }, { duration: 300, easing: tween.easeInOut }); if (this.y < 0) { this.y = 0; } if (this.y > 2048 - this.height) { this.y = 2048 - this.height; } if (background2.y < -background2.height + 2048) { background2.y = -background2.height + 2048; } if (background2.y > 0) { background2.y = 0; } this.x = newPosition.x - this.dragPoint.x; if (this.x < 0) { this.x = 0; } if (this.x > 2048 - this.width) { this.x = 2048 - this.width; } } }; var background2 = LK.getAsset('background2', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); game.addChildAt(background2, 1); scrollbutton.up = function (x, y, obj) { this.alpha = 1; this.dragging = false; this.data = null; }; game.addChild(scrollbutton);
===================================================================
--- original.js
+++ change.js
@@ -85,9 +85,9 @@
anchorY: 0.0,
x: 0,
y: 0
});
-game.addChildAt(background2, 0);
+game.addChildAt(background2, 1);
scrollbutton.up = function (x, y, obj) {
this.alpha = 1;
this.dragging = false;
this.data = null;
2D wreckage of wood, square, HD colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
House from the front facing the screen with big sign above it have description "SHOP", Hd colors
coin with colors, have "DA", hd colors. have black circles and black line for the "DA", between the 2 circles do small black lines all around. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Modern App Store icon, square with rounded corners, HD colors for a 2d game titled "The Collector" and with the description "about building houses and trees and decorations on a map to make it look like city, which then generate "DA" coins after a countdown timer expires. Players can collect these coins to increase their score, which they can then use to purchase more houses and trees and decorations from the shop button on the middle left side of the screen". with text on the middle top of the banner "the collector"!