0 Favourites

Select First / Last Instance of an Object

  • Hello Friends <img src="smileys/smiley1.gif" border="0" align="middle" />

    any way to do that?

    Claim: to set the UID / IID of the first object instance up to the one, which was destroyed before.

    Best regards

  • Use the condition System: Pick nth instance.

    Example capx

  • The last one is clear now, thanks.

    But is instance 0 always the first instance?

    PS: Did you read the update of my post up?

  • Sorry to kick the thread, but i've read all stuff about this on scirra, and did not find a solution...just more questions coming up straight.

    which ID is selected by picking an object instance? UID, or IID? And is there a way to re-sort them during runtime?

    The aim is simple, but c2 seems it can not handle it without additional (instance or global) vars, which makes the events extra complicated:

    i got multiple instances of an object. if one of them destroys, the index of them should keep without "holes".

    But UID is static; IID's does not seem to auto-reindex ...so whats IID for, and how to access an object about it?

    Kyatric: Sorry, but picking instance 0 does not select the first instance of an object, once the first destroyed before.

    So, any answers and ideas welcome <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • IID does auto reindexing.

    Anyway, things would be faster if you explained what your game is about and what you want to use IDs or ordering for ?

  • Hey Yann,

    the game is not that easy to describe in few sentences, but i'll try.

    Imagine multiple "holdpoints" to collect, and through which multiple enemies are random auto-pathed until these points are destroyed after being collected. Also the enemies can be killed.

    Both object types are preset to a route in a city layout (with solid objects etc). To not slowdown fps over the large map (with over 100 enemies+holdpoints+LOS+autopath movement), the limit of moving enemies is currently (the next) 4 along the route, and also they can also only move between (the next) 4 available holdpoints.

    Hope this description helps to understand where it should go.

  • You can compare the IID with (object.Count-1)

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