Pin multiple instances

Get help using Construct 2

Post » Sat May 25, 2013 2:56 pm

Hi.

I have an event sheet which works like this:

On right mouse down.
Trigger once.

Create instance of object.
Pin object to player.


This part works fine, until I try and create multiple instances of the object, at that point the pin command only pins one instance to the player (the remaining instances just spawn at the player origin in the layout and remain static) I need it to pin all created instances to the player.

Any help would be much appreciated.
B
5
Posts: 85
Reputation: 395

Post » Sat May 25, 2013 3:08 pm

Later on, I also need to destroy all instances of the object.
There must be an easy way to do this, but I can't seem to find it.
B
5
Posts: 85
Reputation: 395

Post » Sat May 25, 2013 3:12 pm

You have to pin each one. You might want to look into containers.
ImageImageImage
B
67
S
19
G
123
Posts: 3,209
Reputation: 73,905

Post » Sat May 25, 2013 3:45 pm

Thanks, I would be fine with pinning each one individually, but how do I do that since the pin behaviour calls the object type, not the individual instance?

E.g

Spawn 'object1'
Spawn 'object1'
Pin 'object1' to 'player'
Pin 'object1' to 'player'

This will spawn 2 instances of Object1 but will only pin one instance to the player. How can I pin the second instance?
B
5
Posts: 85
Reputation: 395

Post » Sat May 25, 2013 3:50 pm

Spawn 'object1'
Pin 'object1' to 'player'
Spawn 'object1'
Pin 'object1' to 'player'
ImageImageImage
B
67
S
19
G
123
Posts: 3,209
Reputation: 73,905

Post » Sat May 25, 2013 3:52 pm

Haha, I don't believe it!

Thanks a bunch!
B
5
Posts: 85
Reputation: 395

Post » Sat May 25, 2013 3:57 pm

Are you able so shed any light on destroying instances?

I need to destroy all instances of an object, calling the destroy function multiple times (within a single condition) doesn't seem to have any effect.
B
5
Posts: 85
Reputation: 395

Post » Sat May 25, 2013 4:17 pm

With all instances picked, you just call Destroy once, and they will all be destroyed together. Post a CAPX if this doesn't help.
ImageImageImage
B
67
S
19
G
123
Posts: 3,209
Reputation: 73,905

Post » Sat May 25, 2013 6:38 pm

Aha! I finally found the "all instances" condition!

Thanks so much!

Man, this is so cool, it's a pair of lasers which focus in on a single target, and when they converge a super-laser is fired.

And now it works perfectly!
B
5
Posts: 85
Reputation: 395


Return to How do I....?

Who is online

Users browsing this forum: chcteacher, Televangelist and 26 guests