Advice for spawning on different platforms

Get help using Construct 2

Post » Mon Dec 24, 2012 3:12 pm

I created an endless runner, an basically I have platforms that spawn on the right and go to the left, in which a terminator block destroys the platform bullet outside the layout and then respawns it on the other side.

The platform also has different frames on it to add variety on the platform. so every time the previous platform is destroyed a new platform is created on a different animation frame.

But what I need help with is spawning. How would i choose a specific frame for my platform then spawn an enemy on it?

So basically I want something like this:

*when Platform animation is on frame 3
*spawn enemy on platform 3

I saw a pick nth instance but I'm not quite sure how it works. This may sound like a dumb question but what is an instance? Are they refferring to the object as an instance, or instance variable of an object?

Any help is appreciated
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Wed Dec 26, 2012 2:49 pm

I can't understand your question to be honest. try to explain better what are you looking for.

The instance thing is easy, let's say we have the SpriteX, and we spawn it multiple times. The first that you spawned will be the 1st instance, the second will be the second instance, is like an array of objects.

array = {'Peter','Ann','Josh'}
Peter is the first instance, Ann the second, Josh the tird.wildmedia2012-12-26 14:49:30
B
15
S
3
G
2
Posts: 42
Reputation: 2,412

Post » Wed Dec 26, 2012 10:28 pm

Oh I see, thanks for the explanation.

I want every 3rd instance of my platform sprite to spawn an enemy on top of it. But the thing is onces the character gets past three platforms, three 3 new instances of the same objects apear, and the last 3 are destroyed. If that makes sense. I can expand on this more if your still confused

But first, what happens to the instance object once its destroyed? Is the next object of that same spot assigned the same instance? By that I mean when the three previous objects are destroyed will the new objects just replace the previous ones as 1,2,3, or does it continue from the previous instance and count the newly created object as a new instance? such as 4,5,6

For example:
Let says I spawn 3 bullet objects.
Im assuming there assigned as instances 1 to 3.
But when all three of them are destroyed, will the next 3 spawned bullet objects of the same type become instances 1 to 3? or will it continue past 3 and become 4, 5 and 6?

Im sorry if its confusing I'm still new to construct 2, but I appreciate the help, I can clear up other parts if its still confusing

[QUOTE=wildmedia] I can't understand your question to be honest. try to explain better what are you looking for.

The instance thing is easy, let's say we have the SpriteX, and we spawn it multiple times. The first that you spawned will be the 1st instance, the second will be the second instance, is like an array of objects.

array = {'Peter','Ann','Josh'}
Peter is the first instance, Ann the second, Josh the tird.[/QUOTE] retrodude2012-12-26 22:33:08
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Thu Dec 27, 2012 12:10 am

You could add 1 to a variable every time you spawn a platform and when the variable is a multiple of 3 (variable % 3 = 0) you spawn an enemy.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Thu Dec 27, 2012 3:09 am

I'll try this out, thanks


[QUOTE=ramones] You could add 1 to a variable every time you spawn a platform and when the variable is a multiple of 3 (variable % 3 = 0) you spawn an enemy.[/QUOTE]
B
18
S
4
G
3
Posts: 436
Reputation: 4,801


Return to How do I....?

Who is online

Users browsing this forum: HugeCube, imnotspecial, tomi71, totoe, Yahoo [Bot] and 18 guests