Pin multiple instances

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

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

  • You have to pin each one. You might want to look into containers.

  • 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?

  • Spawn 'object1'

    Pin 'object1' to 'player'

    Spawn 'object1'

    Pin 'object1' to 'player'

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Haha, I don't believe it!

    Thanks a bunch!

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

  • With all instances picked, you just call Destroy once, and they will all be destroyed together. Post a CAPX if this doesn't help.

  • 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!

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