How do I Spawn multiple Sprites without a gap between

0 favourites
  • 10 posts
From the Asset Store
In this template the music plays without looping in your game
  • 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.

  • Try setting X to self.x-128 instead.

  • 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?

  • Do you have your project set to point sampling and have pixel rounding turned on by chance?

  • Pixel Rounding is set to ON

    Sampling set to Point

    I played with those settings and I'm getting same bug

    Thanks

  • 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.

  • 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

    latcounter set X = platcounter.x+platform.width

  • 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.

    [quote:210b6nas]https://www.dropbox.com/s/x442hg4wngyyphd/SpawnSprites.capx?dl=0

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)