Help with scrolling sprites, gaps appearing

0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello!

    I am using 4 reasonably large sprites (320x1024) and they are moving down vertically. Thought I put them down into chunks with the max supported sizes and all.

    Here's the code I use:

    Now, the problem is I get these white 1 high pixel gaps/lines between each sprite. So there's a gap and it's showing the white background.

    Anyone know what's causing this?

    Thanks!

  • Don't set them to 0, subtract your max value. IE: Field2 Subtract 1024.

    You can get rid of the Trigger once., it won't help.

    Not sure why you are checking Field1, but moving Field2 ?!

  • Hi blackhornet,

    Thanks, well they are sprites at the moment so I am using that 'technique' to put the connecting sprite to follow after the other.

    I made the sprites so they can slide down in a loop (sprites have bullet). Now the loop works, it's just that those gaps appear.

    I initially put the trigger once there because otherwise the connecting sprite that is supposed to follow up will forever be placed at that Y position of 0, and never slide down. I'll check if it is still necessary now.

    Anyway, what did you mean by "Don't set them to 0, subtract your max value. IE: Field2 Subtract 1024"?

    How is the code supposed to look like? I don't understand what to change to what.

    Thanks!

    • R
  • http://www.blackhornettechnologies.com/Construct2Stuff/Rudi55_ScrollingBGinY.capx

    Here's an example. I don't have your same dimensions, but you get the idea. You want to move relative to the current position, not to an absolute position, as the movement isn't always by one pixel. If the movement is by, say 3 pixels at a time, you have to compensate for that. The easiest way is to move relatively.

  • Thanks blackhornet !

    Took me some time to adapt it to my own dimensions, but got it working in the end. Am I right that all sprites have to have the same height in order for this to work correctly?

    One thing though, I don't understand what the speed variable does. I mean, the bullet behavior is already there. Does it have to do with the 'every tick'? If I want the bullet speed to be 100, do I need to double the speed variable?

    Programming and logic aren't my best skills I guess.

    Thanks again.

    • R
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry, ignore the Bullet. I was going to use it then changed my mind. I don't know how you were moving your sprites - that doesn't need to change. The key point is to jump relative to the current position.

    Having them the same height makes live easier, otherwise you'd need to trigger each from it's critical position. Triggering off of an adjacent one just makes life harder.

  • Allright thanks, you meant removing the first line right? It's working without that line.

    Thanks again for helping me out!

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