How to remove the white space between wrapping background

Discussion and feedback on Construct 2

Post » Wed Jun 17, 2015 2:48 am

Hi,
I got a another problem need help, I am making a continuously wrapping background, but it always contains a vertical white space between 2 backgrounds, someone knows how to remove it? thanks
Pls see my file in the link:
https://www.dropbox.com/s/w5pkfskdlbg2reb/2.capx?dl=0
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Wed Jun 17, 2015 3:23 am

Use a graphics program to make a single image out of the 2 images.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Wed Jun 17, 2015 6:05 am

if I make the image to one, when it wraps, the white space will be larger than now
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Wed Jun 17, 2015 9:36 am

That's an older problem. Look here h*t*t*ps://w*w*w.scirra.com/forum/scrolling-tiled-background-c2_t63134

I've made an example of an endless scroller with your capx without the wrap behavior.

h*t*t*ps://drive.google.com/file/d/0B5FlDY8sggF4Y1QxSmk2REJPN0k/view?usp=sharing

Hope that will help you.


You have to delete the *
B
2
Posts: 5
Reputation: 160

Post » Wed Jun 17, 2015 6:22 pm

@Erik101: thanks, you file works, but when I want to change the scrolling speed it still show the gap, like when I change "Sprite4.X-int(100*dt) "to "Sprite4.X-int(200*dt)", how can I figure this, thank you so much
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Wed Jun 17, 2015 6:47 pm

It's better to use a tilled background for those kind of movement. I didn't check Erik's example but here is one that should work fine, no matter the scrolling speed.

http://www.eli0s.com/Tests/2.capx (right click and choose Save Link As)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed Jun 17, 2015 8:07 pm

eli0s you are right. The problem are these sprites. But with your example I also get a gap, if the speed is 200 or above.

@laoniustudio
I made a new example with only one tiledbackground, like eli0s suggested. This seems to work. I tested up to (2000*dt) without a gap.

h*t*t*p*s://drive.google.com/file/d/0B5FlDY8sggF4Tm91RFhVY3VNeE0/view?usp=sharing
B
2
Posts: 5
Reputation: 160

Post » Wed Jun 17, 2015 10:23 pm

@eli0s @Erik101, thanks for your help, Erik101's work for me, thank you so much
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Wed Jun 17, 2015 10:24 pm

@Erik101, thanks for your help, it works for me, thank you so much
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Wed Jun 17, 2015 10:31 pm

@Erik101 , if the example that I posted above produces a gap, then perhaps something is wrong with your system.

Your modified example (after mine) is in essence the same, but with a flaw that mine hasn't*: Mine takes into account the TB's current -x position and adds to it the proper offset (TilledBackground.width/2), while yours just set's its x position to 0. That might introduce jumps and apparent jerkiness to the scrolling movement, because if (for example) the scrolling speed is such that on any tick the TB.X is -853 and on the next tick the TB.X is -900 (and the condition for the set X to 0 meet), then there will be a 47px jump from the last position and the next one. On the other hand, if you add its width/2 to the current -x position when the <-854 condition meet, then you will take onto account the 47px offset and end up exactly on the same place.

*Not because I'm smarter, but just because I had Ashley correcting me into the same thing some time ago ;)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests