Spawn Endless Runner Platforms From Predetermined Sprites

Get help using Construct 2

Post » Fri Jun 02, 2017 12:11 pm

I'm trying to produce an endless runner based in part on the template that ships with C2. However, rather than using tilemaps to generate platforms with randomised width and height, I'm using a pre-defined set of platforms with specific widths and heights in a family. The idea is that I can hand paint each specific platform later on, add it to my project and then simply include it in the family so that the code with take the properties of these into account.

However, I'm having trouble getting the platforms to spawn with the desired height and space between them. I've messed around with all of the static values and have a generally good understanding of what everything does but I'm a bit lost as to how to get these platforms to spawn so that the bottom of them is flush with the bottom of the layout and the distance is somewhere between the width of the player sprite and their maximum jump distance.

Ideally, I'd like the platforms to be arranged similarly to the autorunner template. I think that the height issue might be related to the way that Families are referenced? For example, if I reference that the platforms should spawn at LayoutHeight - platforms.Height, I assume that it was take the median height of all platforms in the family rather than pick the one that was spawned in the same action?

I've uploaded the .capx at the following link, if anyone is able to help me out or suggest an easier or better way to handle this, then that would be much appreciated! I can provide any other information if that would be helpful.

https://www.dropbox.com/s/q6o5s8tpl93jdks/RunnerTest.capx?dl=0
B
5
Posts: 10
Reputation: 245

Post » Fri Jun 02, 2017 1:44 pm

@InfiniteRockets

You could try setting the origin point of your platform sprites to the bottom left and just spawn at LayoutHeight, that way the height of the sprite doesn't matter.
Find all the Construct 2 games that were on Steam Greenlight here
B
35
S
9
G
7
Posts: 467
Reputation: 6,864

Post » Sat Jun 03, 2017 12:27 am

You scaled those blocks, wonder how you gonna replace them with blocks hand drawn with 1 to 1 ratio.
I accounted for that (i think).

https://www.dropbox.com/s/vwha0ih9ouyhy ... .capx?dl=0

But. Dont think i would use a family for this. Later on you gonna make levels.
Levels = different graphics & probably different amount of platforms to choose from.
Got the feeling that it will be easier to use 1 instance with all the graphics in.

For each level a different animation.
For each platform a different frame.

Talking performance, if you gonna make a lot and huge hand drawn clunks, they will bite back.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jun 03, 2017 7:29 am

Thank you both so much for your input; that's incredibly helpful. I originally scaled the boxes because I wasn't planning on using this .capx beyond figuring out the platform logic but maybe I should have been working in a manner more reflective of the final game! I had the same thoughts about performance, but this is just going to be a relatively small game with just nine discrete platforms and a single level. The platforms have a rounded end cap on each side which is difficult to replicate with tiles, but perhaps there's a way to create the rounded edges of each platform and pin them into a a generic tiled block when spawned?
B
5
Posts: 10
Reputation: 245

Post » Sun Jun 11, 2017 2:43 pm

In addition to this, does anyone have an idea how I could attach an artwork asset to the surface of each platform when it is spawned? For example, I could create a small blade of grass asset, spawn it (or several), and then pin it to the surface of each platform in a random place to give more variety to the assets. I'm not sure to handle this as the height of each platform is different.
B
5
Posts: 10
Reputation: 245


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 55 guests