need help on pin

  • I have 2 objects Sprite and Particle

    both objects have 4 instance now i want to pin each particle on Sprite

    I tried On start of the layout

    for each particle > pin particle to sprite

    and also tried for each sprite > pin particle to sprite

    but all particles are getting pinned over only one sprite.

    please help on this.

    Note: particle does not overlapping sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you need to pick which sprite and which object go where.

    an easier way is just to create them in On Start of Layout

    Repeat 4 Times
    	Create Object Sprite
    	Sprite Spawn Particles at Imagepoint
    	Particles Pin to Sprite
    

    but this may not what be what you want. Another way would be to give them both an "ID" variable.

    Then loop like this:

    For Each Sprite
    	Particle.myID = Sprite.myID
    		pin Particle to Sprite
    
    

    You could also use IID, but I never use that.

  • > For Each Sprite
    	Particle.myID = Sprite.myID
    		pin Particle to Sprite
    
    

    Thanks jobel this worked.

  • Another Question about Pin from above example

    On Sprite collision with something else i want do something with particles pinned over that Sprite. How can i get that particle?

  • Same stuff, since you used ID variables you can do :

    • Sprite > On Collision with [Any object]
    • System > Pick by comparison Particle where Particle.ID = Sprite.ID

    And then put the action you want

  • a real easy way is to put the particle and the sprite in a Container together. That way when you "pick" the sprite, the particle gets picked along with it.

    also good for clean up, when you destroy the sprite, the particle associated with it also gets deleted.

    same for create, if you Create Object Sprite, it auto creates a particle on top and then you just have to set position, then pin it.

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