How do I populate a layout with groups of objects.

Get help using Construct 2

Post » Sat Apr 16, 2016 6:45 am

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.
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Post » Sat Apr 16, 2016 10:24 am

You can duplicate a layout by rightclicking it ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Apr 16, 2016 11:26 am

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?
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Post » Sat Apr 16, 2016 2:10 pm

The Persist behavior ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Apr 16, 2016 7:58 pm

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.
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Post » Sat Apr 16, 2016 9:45 pm

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.
plugin-scenario_t72381

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Apr 17, 2016 2:31 am

rex_scenario ( or the new version rex_scenarioJ ) is used to load and run an external text script.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

Post » Mon Apr 18, 2016 11:19 am

Sorry for the late reply.

Thanks for this, I'll have a play with this idea.
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Post » Mon Apr 18, 2016 12:04 pm

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



Coming soon on Steam!
B
16
S
9
G
3
Posts: 204
Reputation: 3,466

Post » Mon Apr 18, 2016 8:38 pm

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!
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Next

Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 14 guests