Problems with endless running game

0 favourites
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • wretchedshark, I'm not sure tbh. You'd have to ask rex himself.

    Rory, ok I did some playing around, and without using MoveTo plugin, if you set it up like..

    (USING 128x128 tile)

    Every 1.0 Second

    create tile at 639,440

    tile.X = tile.X - 127 *dt

    ---------------------

    Every 0.5 seconds

    create tile 639, 440

    Every Tick

    tile.X = tile.X - 254 *dt

    --------------------

    The tile movement per second should be 1 less than the tile width. So in the 2nd example, (128 - 1) * 2 = 254... and so on. I have pixel rounding turned on btw.

    Still has the odd gap if something happens in the background, like moving the window around. Seems MoveTo plugin is the same. Was perfect for the slots game I did, but I guess I wasn't moving things too fast.

    Only alternative, is using TileBackground and setting the width. When the width gets too big for your liking, create another TileBackground. At least you decrease the amount of gaps you could have with individual tiles.

  • procrastinator - i looked into it and currently if we want to upload to the arcade it says no third party plugins

  • wretchedshark , ah right. I wasn't too fussed with Arcade so didn't know. Good to know anyway cheers!

    Well, it seems the MoveTo plugin doesn't fix gaps with faster moving tiles anyway. As mentioned above, the movement speed has to be 1 pixel less than the width of the tile if using dt. It covers that annoying 1 pixel gap for the most part.

  • procrastinator Rory - i think the gaps can be gotten rid of by changing the creation equation to create them quicker so they account for the maximum gap there can be.

    since i have been rounding my equation with floor() (to fix a problem with the % mod always being a float and not creating platforms) there are gaps similar to dt gaps which is solved this way.

    the only problem becomes trying to overlay a graphic to polish the aesthetic.

    i've had two thoughts since, (occam's razor, perhaps we are all overthinking it?):

    1) make the creation formula so it creates pre-made platforms picked based on the platformlength variable (then the pretty overlay graphics could be made) continue allowing it to make gaps as it does.

    2) or make an invisible "sensor" off the screen so that when the platformlength is greater than zero and a ground piece is not overlapping it create another (this may suffer at higher speeds?)

    i feel like both of these would allow them to move at a framerate independant speed, i will try fiddling with both. this would also simply my capx, removing the need for a timer (ticker)... in theory!

  • 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 ><

  • 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 ;)

  • 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.

  • shinkan - i'd definitely like to see how you spawn your terrain if you don't mind!

  • 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.capx

  • 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 <img src="smileys/smiley1.gif" border="0" align="middle" />)

  • 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.

    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.

  • 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 <img src="smileys/smiley1.gif" border="0" align="middle" />)

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

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Solid floor runner demo

    Demo

    <img src="http://www.jenpop.com/construct2/solidrunner.png" border="0">

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)