How do I populate a layout with groups of objects.

0 favourites
  • 13 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • So I'm looking to design a bunch of traps using several sprites/objects, and then at the start of the layout populate the level with random traps.

    Each trap would be the size of the window (1280x720), so when you pass one you walk up into the next.

    I'm assuming the best way to do this is with arrays, but everything I have found regarding this seems to have more to do with randomly generating levels, rather than using existing prefabs.

    If there was a way to load the contents of one layout into another layout at a specific location that would be perfect, so I could just design the traps as their own layout and place them at the start.

    Thanks for your help.

  • You can duplicate a layout by rightclicking it ?

  • I'd like to put the contents of a layout into another layout with an event. Pretty sure I can't do this.

    But there must be some other way to populate a layout with prefabricated content?

  • The Persist behavior ?

  • Thanks for the suggestions but I think I've confused matters by mentioning the layout thing. Persist isn't what I'm looking for either.

    I'd like to design a bunch of prefab traps, and then create them later with events.

    So instead of creating a sprite object in game, I'd like to be able to create a group of sprites.

    The traps are going to be simple things, like a group of different spikes with some walls, or a big hole in the ground with a jumping enemy. There'll be lots of them so creating each individual part isn't going to be the most efficient way I'm sure.

    Think Crash Bandicoot but the obstacles are being generated randomly in realtime.

    Hope that clears things up.

  • I'd like to put the contents of a layout into another layout with an event. Pretty sure I can't do this. < Yes you can.

    You can have more layouts. You can switch to another layout with an action. If the objects in that other layout have the The Persist behavior, they will jump with you when you return to the previous layout.

    Just put them in a container to easy destroy them on level change.

    You can even randomly change to layouts. Like system > goto layout choose("trap","spikes","bomb","etc"). And then jump back ofcours.

    For positiong the traps, and for events that go with them, mayby you can use rexrainbow 's scenario.

    I never used that myself, just a tip.

    But there are other ways to position them, with functions by instance. A function for each kind of trap that you feed a position.

  • rex_scenario ( or the new version rex_scenarioJ ) is used to load and run an external text script.

  • Sorry for the late reply.

    Thanks for this, I'll have a play with this idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm wondering, does each "trap" have to have its own complicated logic? Or are they all just recombinations of prefabricated "pieces"? If it's the latter... it's not pretty, but you might be able to do something where you design a trap on a tester layout, and then write yourself a note of all the coordinates of all the "pieces", and then make an event group on the real layout that spawns those same pieces in the same places on the fly. Obviously this is a horrible idea if they're all really complicated. But if you design the traps in a clever way and maybe utilise containers you might just get away with it.

  • I've been thinking the same thing. The traps are really simple, a couple of swinging blades with a pit as an example of one.

    It seems like I could just make a function for each trap type and plug in the coordinates.

    It's going to get messy if I end up with a hundred traps, but for a handful it seems like it might do the trick.

    Thanks for the suggestion!

  • Not sure if this helps, but we generate all of our galaxies dynamically.

    If you have all of your position data pre-generated, it is easy to do.

    https://drive.google.com/file/d/0B-xiqK ... sp=sharing

    Note: This capx requires rex_hash.

  • perhaps you should look at containers... each time you create a container, all the objects appear. of course you may need to re-adjust them if they are different in any way

    I agree with gumshoe, you can use just procedurally generate your layout using events.. then if you need the same layout across multiple layouts you can just wrap it up in a function and call it. it's really not much harder than placing them on the screen manually and at least using events you can be very precise.

    R

  • Yea, math wins (most of the time).

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