PulseRunner (+ livestream!)

@pierostm2000 @jstrahan Thanks!

I haven’t posted the code to GitHub quite yet. In the meantime, let me know if there’s anything specific you would like any pointers on. I’d be happy to explain the tile generation system, culling, parallax, position calculation, etc.

@brainofsteel Thanks for these, I want know, how do you do the tile generation system, I mean, how do you do the random appears of the thins in the screen. Rally thanks.

The tile generation basically boils down to generating a table of solid blocks and then hollowing some of it out, and then tacking it onto the end of the level. Disclaimer: I was working under time pressure. I’m sure there are some much more elegant ways of doing this.

  1. Generate a table of 1’s. These represent solid blocks:

    local newTable = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

  2. Decide on a starting block for the center of the hollowed-out part.

    local caveCenter = math.random(3, 9)

  3. Decide how wide to make that segment of cave.

    local caveWidth = math.random(5, 6)

  4. Based on that, determine the starting removal block.

    local startingRemovalBlock = caveCenter - math.floor(caveWidth * .5)

  5. Now go through and change the section from startingRemovalBlock on down from 1’s into 0’s.

    for i = startingRemovalBlock, startingRemovalBlock + caveWidth do newTable[i] = 0 end

So now, assuming you had generated a cave center of 5 and a cave width of 5, your newTable would look like this:

{1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}

Those 1’s represent the blocks. The 0’s represent empty space.

So that’s how you get the randomness in the blocks. From there you just check the movement of the level on each frame, and if it’s moved over enough that you’re about to have some empty space on the right, just generate a new set of values, generate visual (and physical) blocks and empty space based on those values, and position them vertically on the far right side of the level.

The Vimeo video included near the top of this thread shows the table generation in the first 20 seconds or so. You can see tables of 1’s and 0’s scrolling down the terminal, and then you can see basically the same thing scrolling across the iPad simulator, but it’s blocks and empty space instead of 1’s and 0’s.

Is that helpful?