Spawn different object types.

Get help using Construct 2

Post » Fri Aug 17, 2012 1:46 pm

I need to spawn different types of objects in a certain order for each level.

What type of system can I use to control this and how can I decide what type of object to spawn?

Thanks
B
5
Posts: 15
Reputation: 737

Post » Fri Aug 17, 2012 1:55 pm

you could use triggers (when the character walks over this marker) spawn object to another marker.

instead of making a marker spawn the object - you can use the 'system action' "create object" then set the x and y.

These are the two methods I use, if you experiment a lot with positioning then having the enemies spawn to markers can make it a lot easier to muck around with it.
ImageImage
B
73
S
16
G
6
Posts: 1,039
Reputation: 10,480

Post » Fri Aug 17, 2012 2:08 pm

This is similar to the solution I am currently working on. The part I'm having difficulty with is deciding which object to spawn.

Would using an array to store which objects and what order to spawn them in be the best solution here?
B
5
Posts: 15
Reputation: 737

Post » Fri Aug 17, 2012 2:14 pm

You could use arrays, for me it complicates things though.

You could make a marker spawn a random monster if you wanted, but if say you wanted a line of four guys, then I would use four markers for simplicity. Or If i really only wanted one marker I would use image points to put them in the order I wanted.

So the event would look like;

Player on collision with (trigger) --> Marker1 : Spawn x monster
                                           --> Marker2 : Spawn y monster

Hope this helps.GenkiGenga2012-08-17 14:16:59
ImageImage
B
73
S
16
G
6
Posts: 1,039
Reputation: 10,480

Post » Fri Aug 17, 2012 2:58 pm

Nope this isn't really what I am looking for. Maybe you've misunderstood me.

Think angrybirds, the way you have different types of birds in a set order for each level. Once one has been used up the next one spawns. I need something similar to that system.

Cheers.
B
5
Posts: 15
Reputation: 737

Post » Fri Aug 17, 2012 3:07 pm

quick idea
What about setting text variable ie:
Global variable: spawn_order = "blue,red,grey,white"
and then using TokenAt you could separate and specify which one will spawn first, second, third...
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Sat Jul 27, 2013 3:11 am

[QUOTE=shinkan] quick idea
What about setting text variable ie:
Global variable: spawn_order = "blue,red,grey,white"
and then using TokenAt you could separate and specify which one will spawn first, second, third...[/QUOTE]


What a great idea for an alternative to Arrays.. complicate things why don't you?.

//* CAUTION CODE AHEAD */
if I
store spawn_order = "blue,red,grey,white"
inPlay = | spawn_order(TokenAt(random(0,4))|

foreach spaw_order | == inPLay|

call function | loadInplay(inPLay)

function loadInPlay(inPlay)
if inPLay == red|
use |system createObject( red)

this is just a rough idea, no screenshots as yet just thinking off the top of my head
/* END OF CODE */

would this get a random colour?

vinstah2013-07-27 03:32:40
B
3
Posts: 6
Reputation: 212


Return to How do I....?

Who is online

Users browsing this forum: BipolarMike, totoe, Yahoo [Bot] and 19 guests