Problems with endless running game

Get help using Construct 2

Post » Thu Jan 31, 2013 10:52 pm

@wretchedshark @procrastinator

Thanks again for looking into this again, I did try your No.2 solution wretched, but it didn't seem to work, still had gaps present.
I considered the overlay graphics, but I still think there could be a better solution to this ><
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Thu Jan 31, 2013 11:08 pm

Trench Run

Maybe something like this? An old capx i've made.
It's vertical, but can be easily modified to horizontal - and no gaps ;)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Feb 01, 2013 12:23 am

endlessRunner.capx (r114)
You want to spawn the next sprite right after the last one (ie. lastsprite.x + lastsprite.width if the origin is on the left side). Spawning at a fixed x position will always leave gaps.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Feb 01, 2013 1:32 am

@shinkan - i'd definitely like to see how you spawn your terrain if you don't mind!
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Fri Feb 01, 2013 2:29 am

@ramones - i tweaked your capx to fit my idea of spawning as close as i could get it to act how i want it too, i think you are right about gaps.

@Rory - it seems that no matter what there will be gaps because the framerate is ALWAYS fluctuating (and therefore the gaps aren't even even). if there were some way to lock down the framerate to 60 or 30 for lower framerates, there might be a way to account for dt, otherwise nothing i can think of.

you can subtract dt * groundSpeed from the X spawn point to get them to overlap, if you use large ground pieces - heightwise - with plain cover it's not noticeable. if you are doing a platform, gap, platform, gap loop then the player won't be out these pixels and miss a jump because the gap spawned slightly to large.

https://www.dropbox.com/s/n8oyndhyz10ktdv/endlessRunner.capxwretchedshark2013-02-01 02:30:55
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Fri Feb 01, 2013 3:21 am

ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Feb 01, 2013 5:42 am

@shinkan - appreciate the example, i was wondering if you wouldn't mind answering a question?

if so:
- your bg scrolls using dt but isn't reset using dt (as far as i can tell), is the tiled background somehow accounting for dt?
(your obstacles don't appear to spawn stacked or in a row which is why i'm asking about the background )
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Fri Feb 01, 2013 7:36 am

[QUOTE=ramones] endlessRunner.capx (r114)
You want to spawn the next sprite right after the last one (ie. lastsprite.x + lastsprite.width if the origin is on the left side). Spawning at a fixed x position will always leave gaps.[/QUOTE]

Ah good to know!

In my slots game, I do have it creating the new segment relative to the very top segment. Maybe it wasn't MoveTo that fixed it for me afterall. I had to create it relative because I wanted to be able to position the reels anywhere at edit time without having to edit the fixed position every time.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Feb 01, 2013 2:28 pm

[QUOTE=wretchedshark] @shinkan - appreciate the example, i was wondering if you wouldn't mind answering a question?

if so:
- your bg scrolls using dt but isn't reset using dt (as far as i can tell), is the tiled background somehow accounting for dt?
(your obstacles don't appear to spawn stacked or in a row which is why i'm asking about the background )[/QUOTE]


What do you mean "isn't reset using dt"?

ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Feb 01, 2013 7:04 pm

@shinkan - there are no gaps when your tiled background scrolls off the screen and resets up the screen but the code doesn't "reset" the Y position of the tiled background using dt "set Y to self.y -1080"

or is it because it's using it's current Y (which could be a float) that it is already accounting for dt upon resetting back up the screen?

...that gives me an idea

B
14
S
6
G
2
Posts: 136
Reputation: 3,210

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Matthew de, Yahoo [Bot] and 21 guests