Select the closest instance

This forum is currently in read-only mode.
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • Hi!

    I searched a lot for that one... honnest!

    What's the principle for the selection of instances using events? I want to create a generic enemy spawner that I can copy paste infinitly, but the enemy will only spawn on the first instance ever created... it's also the only instance considered for proximity triggering.

  • hat's the principle for the selection of instances using events?

    Go to the wiki to understand how picking instances works: sourceforge.net/apps/mediawiki/construct/index.php

  • hmm yeah I did, thanks for the tip by the way, but I still don't get it perfectly.

    As I understand, if you don't specify any condition other condition than say "every tick", it should pick all instances? Only one seems to be considered in my case...

    But if say I modify the private variable from a newly created instance it will still change it for every existing instances?

    How can I say pick the closest instance?

    Infinite thanks.

  • hmm yeah I did, thanks for the tip by the way, but I still don't get it perfectly.

    As I understand, if you don't specify any condition other condition than say "every tick", it should pick all instances? Only one seems to be considered in my case...

    But if say I modify the private variable from a newly created instance it will still change it for every existing instances?

    How can I say pick the closest instance?

    Infinite thanks.

    All those questions are answered in the wiki, are you sure you read it? <img src="smileys/smiley17.gif" border="0" align="middle" />

    Most of the time, when nothing is specified all instances are picked. For example:

    +Always

    -> mySprite: Set X to .X + 1

    is essentially the same as

    +For each mySprite

    -> mySprite: Set X to .X + 1

    If you experience something else, then there are other conditions, that make only the first instance getting picked.

    If you create an instance it is automatically picked for that event. So, if you change the pv, you only change it on the instance.

    You pick the closest instance by using the appropriate object's condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes read it and I appreciate the help, my brain just works differently. In all sincerity I will never ask for help unless I spent several hours reading and trying to figure it out.

    You pick the closest instance by using the appropriate object's condition.

    Well that seems to be just what I'm looking for, what would be the appropriate object's condition?

  • If you look at your object's conditions you will find a "Pick closest" where you specify the X and Y reference coordinates. Quite obvious if you know the basics of construct.

  • ahhh... well that was quite obviously simpler than I thought. I was at a stage where I was comparing hypotenuses. Well, you know, sometime you need a little help.

    Thanks a bunch!

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