0 Favourites

Python - hinge problem

This forum is currently in read-only mode.
  • Hi there,

    I would like to use the hingetoobject function, but I don't know how to access one of the istances. I searched the forum for hours, but I got nothing, so any help would be great..

    I can access the first object(wich I want to hinge to the other object), but I don't know where to go from there.

    Here is the snippet:

    for i in range(0, 5):

         System.CreateByName("chain", 1, Sprite.X, Sprite.Y + 100 + i*chain.Height)

         SOL.chain.SetValue('ID', i)

         SOL.chainPhysics.HingeToObject("chain",0,0)

    How can I reffer to a specified instance of the chain object?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I was going to say that you would need to use events for that but then I found a solution:

    for i in range(5):
       System.Create("chain", 1, Sprite.X + i*32, Sprite.Y)
       SOL.chainPhysics.DisableCollision("Sprite")
       if i == 0:
          SOL.chainPhysics.HingeToObject("Sprite",0,0)
       else:
          prev_chain.HingeToObject("chain",0,0)
       prev_chain=SOL.chainPhysics[0]

    It attaches the first link to the sprite object.

  • Wow, thanks for the help, it works like a charm.:)

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