Spawn Endless Runner Platforms From Predetermined Sprites

0 favourites
  • 5 posts
From the Asset Store
Endless Runner V1 - very positive, joyful, energetic track with upbeat mood and dance club rhythmic beat!
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

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

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

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