How do I move objects instance with one button

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • i have object with six instances of it

    i want to move all six instances with one button and get back to their position with another button

    how can i do this

  • If you don't specify a specific instance in the event the actions will be executed by all instances..

    If you only want to move specific instances you should make it clear which ones, for example by giving them an instance variable or putting them on a specific layer or any other way to differentiate them from other instances and add the condition needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • but i have no idea how to specify one instance

    m not getting this point

  • but i have no idea how to specify one instance

    m not getting this point

    If you want all instances to react at the same time you don't have to specify one instance..

    If you want one instance to react, you should tell the computer which one..

    If you know which one you mean, you should be able to tell the computer..

    For example, select an instance by touching it, pick the nearest to something, etcetera..

  • I'm new to Construct 2 so this could be wrong:

    • when you create the buttons, make them find the UID for all 6 instances of the object you want to move and store them (in a uid array)
    • when the first button is clicked, loop through the array and use the "pick using UID" action to pick each one, store it's location (in a global location array), then move it
    • when the other button is clicked, do the same loop but this time put the picked object back where the global location array says it used to be

    How you find the UID of the particular objects is what LIttleStain has covered already.

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