Seamless Wrapping

For questions about using Classic.

Post » Tue Oct 13, 2009 5:02 am

I'm not sure if Construct has a feature for this already or if it's something I'll have to code myself (I really hope not), so I figure I'll ask. I'm trying to create a game where the 'A' and 'D' keys pan to the left and right of an environment. The environment is twice the size of the view the player will have, or in other words, the player will only be able to see half the level at any given time. Would it be possible to have it so that when the player's view reaches a horizontal edge (x=0 or 1600) the view continues through on the opposite side. I don't want to just have the view abruptly shift to the other side of the level, but rather want a smooth panning.

Help?
B
2
G
3
Posts: 68
Reputation: 986

Post » Tue Oct 13, 2009 1:40 pm

you could likely do this through trickery. you need the two edges to visually "tile" perfectly with one another. Then you'd atually "teleport" the "camera" to the matching opposite end a the apropriate time...

I think it would work but will take some time to perfect
B
2
S
2
G
4
Posts: 124
Reputation: 1,698

Post » Tue Oct 13, 2009 1:59 pm

Use a Tiled Background object for your environment (if it's static), then you could just change the image offset with events accordingly. I have done it before and it works like a charm. :)
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Oct 13, 2009 4:28 pm

I have objects in the environment as well, though. This seems really messy... ehhh
B
2
G
3
Posts: 68
Reputation: 986

Post » Tue Oct 13, 2009 4:50 pm

Well, we are all talking theory here. If you cared to share a cap, things could get much more specific. :D
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Oct 13, 2009 4:53 pm

I don't have a cap. I wasn't about to start coding something like that without first verifying there wasn't already a built in function that could wrap a view around the edges.
B
2
G
3
Posts: 68
Reputation: 986

Post » Tue Oct 13, 2009 5:10 pm

Oh in that case you should try to figure something out. There is still the Wrap behavior, which I failed to use properly in a scrolling game. But maybe somebody else has more experience with it.

[quote="Farmrush":23l3kie7]I have objects in the environment as well, though. This seems really messy... ehhh[/quote:23l3kie7]

What do you mean you have objects in the environment? Are we talking about some sort of seamless scrolling background? Your objects (enemies, powerups) or whatever would be seperate objects so I don't really get what's the problem with that. :?

You really should try to prototype this. In most cases it can be done in Construct.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Oct 13, 2009 6:05 pm

I'll have to prototype it, because it doesn't seem like anyone knows what I'm talking about.

I'll try to explain it more comprehensively, but failing that I guess I'm on my own. Essentially the level will be 1600x600 pixels in size (W x H), but the player's view will only be 800x600 in size. When the player is viewing the edge of a level, rather than having it just bump up against the side I'd like for it to wrap around so that if I were to keep moving in one direction it would smoothly pan through the level indefinitely.


[url:2pe5xx1q]http://pub.gamingw.net/39880/wrapping.jpg[/url:2pe5xx1q]
B
2
G
3
Posts: 68
Reputation: 986

Post » Tue Oct 13, 2009 6:29 pm

this one is for background looping with wrapping, press right key and background will loop indefinetly

[url:18awczer]http://www.4shared.com/file/140637397/61a8b6e/backgroundscroll.html[/url:18awczer]

this could be used for active content looping i guess
(and could be much improved)

[url:18awczer]http://www.4shared.com/file/138306311/b15b6f2b/loopingbackground.html[/url:18awczer]
B
2
G
3
Posts: 72
Reputation: 994

Post » Tue Oct 13, 2009 6:42 pm

Thanks, however in that example the player moves indefinitely in a direction and would never encounter any of the objects he had already seen again, thus it is not 'wrapping' back around to the beginning.

Here is an updated diagram: [url:20gs1t7r]http://pub.gamingw.net/39880/wrapping_1.jpg[/url:20gs1t7r]

Imagine you have a cut a vertical strip from a 8.5x11" sheet of paper. You draw your level layout on that strip. Now, take that strip, fold it so that one of the shortest edges touches the opposite edge, and tape it. Now when you go through your level you rotate the ring in your hands, and when you get to one edge of the level you are simply back at the start.
B
2
G
3
Posts: 68
Reputation: 986

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests