How do I Spawn multiple Sprites without a gap between

Get help using Construct 2

Post » Sun May 10, 2015 6:35 am

I'm working on the endless runner game, and as "floor" I'm using sprite image with animation frames.
I have a problem with spawning those Sprites (with Bullet Behavior) without a gaps between.
I want them to be exactly snapped every 128pixels.

Any idea how I can fix this or what other method I should use rather than sprites?

Thanks for your help in advance.

Here's my code example and screenshot with a problem.

Image
Image
B
6
Posts: 8
Reputation: 283

Post » Sun May 10, 2015 7:11 am

Try setting X to self.x-128 instead.
Image
B
76
S
28
G
12
Posts: 515
Reputation: 12,409

Post » Sun May 10, 2015 7:37 am

I did this:
PlatCounter | Set X to self.X+128 (as with "Minus" it send my PlatCounter object "out of" the screen and spawn sprites every tick I think)

With above formula my spawning reproduce same bug with a small gap. So no improvement unfortunately,
any other ideas?
B
6
Posts: 8
Reputation: 283

Post » Sun May 10, 2015 8:08 am

Do you have your project set to point sampling and have pixel rounding turned on by chance?
B
49
S
9
G
4
Posts: 426
Reputation: 7,041

Post » Sun May 10, 2015 8:16 am

Pixel Rounding is set to ON
Sampling set to Point

I played with those settings and I'm getting same bug :(
Thanks
B
6
Posts: 8
Reputation: 283

Post » Sun May 10, 2015 10:51 am

right. for pixel art you had it set properly, with rounding on and point sampling.

I recommend you use an action using a number multiplied by dt (deltatime) to move everything at once in a for each object loop instead of everything having their own bullet behavior. Most likely its the slight asynchronicity of all the bullet behaviors that is causing the problem.

In other words, put all the road sprites in a family

Then do a for each member of that family loop and move them all to the left by the same equation. This will guarantee everything moves in unison etc.
B
49
S
9
G
4
Posts: 426
Reputation: 7,041

Post » Sun May 10, 2015 12:11 pm

I'm not really sure if this is what you are trying to achieve, but:

--- platcounter x<768
> platcounter set x = platcounter.x+platcounter.width
> platcounter spawn platform

or

--- platcounter x<768
> platcounter spawn platform
>Platcounter set X = platcounter.x+platform.width
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 11, 2015 4:01 pm

I tried to fix it guys but I'm running out of ideas, plus I'm unable to use families as I have only free version of Construct atm, and I'm a newbie with coding/scripting :|
I'm attaching example of my problem in a link. If anybody can make it working (without a gaps between sprites) it would be highly appreciated.

https://www.dropbox.com/s/x442hg4wngyyphd/SpawnSprites.capx?dl=0
B
6
Posts: 8
Reputation: 283

Post » Mon May 11, 2015 4:12 pm

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 11, 2015 4:26 pm

Problem is Fixed
There's was a single "gap" on initial spawn between Platforms that I placed in the editor, and ones that got spawned.
I moved "event" that spawn platforms above "event" where I set bullet speed and looks like it fix problem completely.

Thanks a lot for your help, now I can move forward with my project :)
B
6
Posts: 8
Reputation: 283


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, duditon, Kermad, R0J0hound, yiuyiu6666 and 7 guests