Suggestion for continuous scrolling

Discussion and feedback on Construct 2

Post » Wed Oct 01, 2014 1:59 am

Hey Name, I was happy with Ashley's solution for my purpose but I'd be happy to help you with yours. Just need to clarify the problem.

http://www.youtube.com/watch?v=-ZUEmn9lo6Q is this the type of thing your trying to achieve? Mario passes through one side and appears on the other.
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Wed Oct 01, 2014 3:52 pm

@GenkiGenga Mario Bros. is partially what I'm looking for. I have an 8x8 grid full of sprites, which is smaller than the viewport, so, unfortunately, the Wrap behavior doesn't work, which is what Mario Bros. used.

Right now, I have all the sprites in an entire row/column of the grid moving according to the touch swipe direction. I would like to achieve a "wrap" effect where you can see the sprite on both sides of the grid as it passes through the border of the grid. So the pixels that move off the grid on the right side, appear on the left and vice versa.

I've tried doing: for each sprite in row swiped -> if sprite.X < grid.X -> sprite.x = sprite.width

That doesn't work. I mean, technically it does what it says it's doing...it moves the sprite to where the width of the sprite is, but that's not what I want. lol
B
8
S
1
Posts: 67
Reputation: 859

Post » Thu Oct 02, 2014 5:29 am

@iwontnamemyself I understand now. The easiest way I can think of is to use some masking. When a sprite passes into the masking area an identical sprite is created on the other side of the grid. When completely concealed it is destroyed so it appears to be wrapping when it isn't.

Here is a quick example. https://db.tt/CrSS6Qp9

Hopefully your current backgrounds can accommodate this technique without too much fuss.
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Thu Oct 02, 2014 4:35 pm

@GenkiGenga I actually started working on a masked version just yesterday. lol I'm using a few @rexrainbow plugins and behaviors though, so I'm not exactly sure how this will affect/alter the board array. It may turn out that I need to ditch the these add-ons and go for a plain old fashioned 2D array and then manually set the new array coordinates after the sprite has moved.

Thank you so much for this example though!!! It's not exactly what I'm looking for cuz I need to be able to move each row/column back and forth through the grid, but this is a good start. I've have to tinker around with this example a little bit to figure out how I can use it to may advantage.

Thanks again @GenkiGenga :)
B
8
S
1
Posts: 67
Reputation: 859

Post » Fri Oct 03, 2014 2:31 am

it might be possible to use a scrolling background to fool the player into thinking they are constantly moving... you should then pause this and restart once they lose a life, or whatever you want to cause this...
B
8
S
2
Posts: 134
Reputation: 1,001

Post » Fri Oct 03, 2014 5:49 am

No worries. I am sure you'll pick it up quickly but feel free to send me a pm if you get stuck with it. Have fun creating! :)
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: eli0s, Lof, RageByte and 8 guests