Master Slave Instances? (Solved with .capx)

0 favourites
  • 11 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Hi!

    I hope my jpg explains the issue im having.

    I truly need some help with this, as i ran out of ways to tackle this.

    Basically what i need is: to set multiple masters, and then connect multiple slaves to a single master.

    Extra info:

    All sprites are already on screen (so no spawning is involved here).

    And all are instances of 1 particular sprite.

    The image explains it best i think.

    I really hope someone out there can help me with this.

    Kind Regards

    Savvy001

    "Sorry if i double posted this "how to" but with the last one, i did not explain it correctly so it went overdue.

  • Still the same solution:

    Create a variable Int: lastMaster

    Create a family and set up two instance variables:

    Boolean master

    Int connectedToMaster

    Select master:

    On touched object Family

    set Family master to true

    set lastMaster to Family.UID

    Select slaves:

    On touched object Family

    set connectedToMaster lastMaster

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanx for the reply, but the problem is that i cant pick a instance and compare it to another instance to be able to connect one to the other.

    I simply cant find a option for that in construct.

    So by that i dont truly understand your solution.

    Probably because i am not fully aware of possibilities.

  • Now i am succesfull in setting a master and a slave.

    But connecting them via a pin behavior or otherwise is currently the problem.

    I am trying:

    Pick by comparison/pick by evaluate/pick by instance.

    But non of these let me pick the slave instance so that then i can pin them to the master instance.

    Normally this would be no problem between sprites "non same instance".

    Then i would state, pick sprite (a) pin to sprite (b).

  • Fixed it!

    It has been a ride but now i works just perfectly.

    Thanx!!!

  • Savvy001, would you mind posting your solution so that others can also learn how to do this?

  • Here u go!

    http://www.vrijetoekomst.nl/Apps/MasterSlave.capx

    Click on set Master button and then a sprite to set a master.

    Then click on set Slave button, and then a other sprite to let it rotate around the master.

    When u then click on the set Master button again u can set a second Master/and third etc.

    Just remember that after u have set the master, the slaves u will set are connected to that master.

    u can also click on set Master and then a previous master u already set to start adding slaves to that specific master.

    The slaves are drag & drop, and the more distance u put between the slave and the master, the slower the rotation of the slave around the master.

    Have fun!

  • I'm glad you found a solution and I hopefully could help you a bit

  • Yes u did.

    And thank u for that!

  • You really should avoid these Foreach Loops. They are triggered every tick and will make your games performance very poor. Is it necessary to drag n drop the slaves?

  • Both are needed for the app im building.

    It works just fine with no slowdown in game performance.

    That is because my app is setup correctly.

    But for everyone else your comment should truly be taken in account.

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