Help with scrolling sprites, gaps appearing

Get help using Construct 2

Post » Tue Sep 05, 2017 8:18 pm

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:

Image

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.

Image

Anyone know what's causing this?

Thanks!
B
13
S
7
G
4
Posts: 143
Reputation: 3,581

Post » Tue Sep 05, 2017 8:37 pm

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 ?!
ImageImageImage
B
71
S
21
G
229
Posts: 3,687
Reputation: 128,338

Post » Thu Sep 07, 2017 10:36 am

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
B
13
S
7
G
4
Posts: 143
Reputation: 3,581

Post » Thu Sep 07, 2017 1:48 pm

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.
ImageImageImage
B
71
S
21
G
229
Posts: 3,687
Reputation: 128,338

Post » Thu Sep 07, 2017 5:32 pm

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
B
13
S
7
G
4
Posts: 143
Reputation: 3,581

Post » Thu Sep 07, 2017 6:07 pm

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.
ImageImageImage
B
71
S
21
G
229
Posts: 3,687
Reputation: 128,338

Post » Thu Sep 07, 2017 8:39 pm

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

Thanks again for helping me out!
B
13
S
7
G
4
Posts: 143
Reputation: 3,581


Return to How do I....?

Who is online

Users browsing this forum: Lancifer, Nicolas951 and 23 guests