How do I check if an object is part of a Particle?

0 favourites
  • 5 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Hi there. I have some coins.

    These coins spawn a Particle, to create a shine effect. These Particles use the built-in functionality of spawning a separate object as part of the system instead of the using Particle's own image.

    As you can see, all of the shine effects are gold. I would like the silver ones to have a silver shine, and the Sprite object I am using has animations for both gold and silver.

    How can I check if the Particle the object is a part of is gold or silver?

  • The only solution I can think of is to check which coin is the nearest (or overlapping) when the effect object is created.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The only solution I can think of is to check which coin is the nearest (or overlapping) when the effect object is created.

    I thought about this and have tested it, but this method is very rudimentary and not entirely accurate depending on how the Particle objects end up moving.

  • So you have coin -> particle object -> effect sprite. The effect sprite is always spawned at the particle object position. If you know which coin the particle object is attached to (say with hierarchy or pin), you can accurately pick that coin.

    EffectSprite On Created
    Particle X=EffectSprite.x
    Particle Y=EffectSprite.y
    Particle pick parent Coin
    

    or simply:

    EffectSprite On Created
    EffectSprite is overlapping Coin
    
  • The effect sprite is always spawned at the particle object position. If you know which coin the particle object is attached to (say with hierarchy or pin), you can accurately pick that coin.

    My effect sprites are given a small random offset in the particle parameters itself. There's a chance that, through sheer randomness, they could end up 'closer' to a different coin than the one that they are spawning from.

    Currently, I have the coin spawning a particle system and adding that system as a child. The system then spawns effect sprites. The root of the issue is that there's no way to actually make the connection between the particle system and its spawned effect sprites, unless there's some way Scripting could access that?

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