How do I Isolate a specific instance of a sprite?

0 favourites
  • 5 posts
From the Asset Store
Isolated Ambience Loops is a cross genre sound library of loops for creating unique sound beds and background tracks.
  • Hi,

    I was just wondering if there was a way of picking on a specific instance of an object. Say for example you had 6 bad guys on screen and you wanted to make one randomly glow to signal when the player can destroy him, all 6 are just copies of the same sprite so is there anyway to isolate the individual instance(s)? There is prob an easy solution staring me in the face sorry lol!

    Regards

    Joel

  • You can pick by nth instance (a System expression), a.k.a IID, and use random( sprite.count) to pick.

  • You can pick by nth instance (a System expression), a.k.a IID, and use random( sprite.count) to pick.

    Thank you I will give this a shot, I always assumed Sprite.Count would just use the maximum amount of that sprite I.e the number of that sprite it counts as created. Will let you know how it works out, thank you very much for your reply.

  • > You can pick by nth instance (a System expression), a.k.a IID, and use random( sprite.count) to pick.

    >

    Thank you I will give this a shot, I always assumed Sprite.Count would just use the maximum amount of that sprite I.e the number of that sprite it counts as created. Will let you know how it works out, thank you very much for your reply.

    It is the number of currently created instances of an object, so if you had more than 6 instances (some off-screen), but only wanted to pick from the ones on-screen, then you would first pick by the 'onscreen' expression, then by perhaps by an expression where 'Sprite.IID = random(Sprite.PickedCount)'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • >

    > > You can pick by nth instance (a System expression), a.k.a IID, and use random( sprite.count) to pick.

    > >

    >

    > Thank you I will give this a shot, I always assumed Sprite.Count would just use the maximum amount of that sprite I.e the number of that sprite it counts as created. Will let you know how it works out, thank you very much for your reply.

    >

    It is the number of currently created instances of an object, so if you had more than 6 instances (some off-screen), but only wanted to pick from the ones on-screen, then you would first pick by the 'onscreen' expression, then by perhaps by an expression where 'Sprite.IID = random(Sprite.PickedCount)'.

    It worked a treat, thank you so much! I knew it would be something simple, glad you stopped me from my over complicated approach.

    Regards

    Joel

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