How do I perform an action only for the instance that triggered it?

0 favourites
  • 3 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • What I´m trying to do is making the cargo jump back to it´s original position if it doesn´t fit inside the box. The black lines surrounding the top left box is the border collision. This works there are only one instance of the cargo in the layout. But if there are more than one, all of them jump back, even if only one of them overlapped the border. How do I make it so that only the instance that overlapped the border jumps back while the rest of them stay where they are?

    Please explain as simple as you can, since I´m not a an experienced game developer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your function that repositions the Vara does not know which specific Vara you want to move because you have just told it to move all of them when the function is called. If you are picking a specific instance of an object and you want to do something with that instance only, you need to put the actions within that same event or sub events after the picking has happened. Alternatively you can tell the function which instance you want it to affect but to do that requires extra steps and passing the instance UID as a variable into the function.

    Easy option. Delete events 4,5,6&7. As a sub event under Event 2, add in the Vara is overlapping Collision condition (that was previously event 7) and then add the Vara set position to MenyBlock action (from the function) into that event.

  • calminthenight

    Hey! It worked. Thank you very much for taking the time to teach me this. Have a nice day!

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