How do I change between objects' IID

0 favourites
  • 8 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)