Coding a 2D Scrolling Tunnel

Apologises for the broad, unformed, naive question. I have been reading around for some time now…

I would like to use a level for my game where the user sprite hovers through a tunnel.

Please can anyone guide me how to approach the problem of coding the scrolling 2-D tunnel?

I would be happy for general guidance regards the correct techniques to use…

Thanks & Sorry for the Daft Query :confused:

AndyF.

tunnel

Sure, we all can help.

First, tell us what you think about how to get to the solution and we can go from there. Seriously, we can give you code all day, every day, but if you dont understand it you wont ever release a game or worse you will release a buggy pile of cr*p and wont be able to fix it.

Teach a man to fish…

@slackmoehrle

Code I don’t expect. Some general ideas of how to approach the problem??

For instance, and this will be nonsense, make each portion of the tunnel body a sprite from a png, attached a physics body and then scroll using a scrollview…

As I said, I have not a clue as how to start…

yeah, don’t do that method, lol :slight_smile:

I think @grimfate would be good with ideas here. If it were me, I couldn’t be using a sprite at all for section tunnels, but that is just me. I’ll think about this a bit and post my thoughts

I would do something like below. Just have two of them.

2 Likes

making each portion of tunnel body a sprite from a png, attach physics and scroll using parallax node. Is actually a pretty good idea. its cheap and can be easily managed.

I was thinking of drawing the tunnel boundaries from points and adding physics. Could alter the shape of the tunnel by moving points.

Thanks for all the replies. Think I will check out @kyle_bong2 link first.

Anything to swerve the work, eh :wink:

Thanks for the pointer.

Thanks for the comment.

Will check that idea out, thanks.

Hi,
we made game for our client called Curve Line, its similar to your idea.
Download here for Android : Game Link
We created 16 predefined road shapes, taken predefined points for each shapes. After that we are giving that polygon as runaction (cpp-test will help you).
Created our algo such a way that each shape can be put as 0, 90 or -90 degree, so at runtime we put random shapes and attach to old shapes and game goes infinite.

Video Trailer:

Look at this another game,

I liked this game 2.5 year back, yeah that back and still remembered this game.
Just pointing you out, play this both game and create your own code.
I dont know your final goal but i hope this will help you.