0 Favourites

How do I change between objects' IID

  • I add an object to the layout then copy and paste it a few times to create the instances.

    I want to be able to switch from one IID to another through "Action"... but it seems the only way to pick the IID is through System Event. I dont want to use UID as i know my IID's.

    I have created a Function with actions

    I want the Actions to pick the object with IID 1 then perform actions on that instance

    then pick IID 2 and perform actions on that instance.

    I'm not sure if i have the structure wrong but the only way i see to change or pick the IID is in a system event but all the system events in that Function happen all at once and not in sequence.

    Im finding i have to create a new separate Function each time i want to change the selected IID.

  • You can try:

    On event/function/condition: sprite(1) action 'sprite with IID=1 action

    sprite(3) action 'sprite with IID=3 action and so on

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Im sorry but either i dont understand that or your not understanding my question.

    I can't add a condition to the action, only the Function Event. I want the action to change the IID.

    In general :

    Function ( On "Testing")

    Action = choose sprite with IID 1

    Action = rotate the sprite selected above 45 degrees

    Action = wait 5 seconds

    Action = choose sprite with IID 2

    Action = rotate this particular sprite counter clock wise

    "I'm trying to apply actions to each of the sprites with a certain IID separately "

    The way i accomplish that now is :

    "choose sprite with IID 1" is located in another Function then called on from "Testing"

    It is a System Event and will apply when that function is called then all the actions will apply to that IID as well.

    I dont know if this is the only way but id rather have all the particular code in 1 function.

  • Sorry, I misread your post...

    You want something like this?

  • You can add a sub event to the function to choose that IID, but I don't think choosing something by IID is available as an action.

  • NP, thanks for that example

    that is essentially what i had already started with but also mentioned that the problem is that all the "System" Events are occurring at the same time when the function is called or the event occurs.

    So in your example when the Enter key is pressed each sprite does rotate separately and that is what i already had but not desired outcome.

    Problem is i need 1 to complete before the next is started such as putting in the "Wait 5 seconds".

    I currently have each action in a new function so that i can have it wait before calling the next function. But the code for it grows cumbersome.

    So in your example i would want to rotate the first sprite then wait 1 second before the next sprite is rotated and so on.

    If i had 100 sprites for example that would mean 100 calls to a function to perform some actions then another 100 functions to call if i want to perform different actions. So thats my dilemma

    I couldn't get it to work in sub events either.

  • kcmd

    I updated the link with another layout which uses function (for all sprite with the same delayed action)

  • Hey that one works pretty good.

    Thanks for your time.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
195 16,205
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
99 10,158
karshinkoff's avatar
karshinkoff
Unread hot topic
167 14,517
DMT2005's avatar
DMT2005