pick pin id that is attached to an object?

  • I have a ship and it creates an antenna that couples the ship, after a few seconds the system creates one more ship (same object as the first ship) and that second ship creates another antenna that couples the second ship. is there a way to get the antenna id of the first and second ship?

  • Hey rafaelsorgato,

    One way to do this is to store the Antenna's UID (Unique ID) at the moment it is being pinned to the Ship.

    For the Ship, create a private variable called "antenna_uid".

    In the event sheet, just below the action that pins the Antenna to the Ship, add the action,

    Set the Ship's private variable "antenna_uid" to contain the Antenna's UID.

    Now each ship will store the UID of it's personal Antenna.

    To pick the Antenna, use the condition,

    Antenna: Pick by UID: And use the Ship's "antenna_uid" as the value.

  • fisholith thanks, i will try it

  • fisholith

    the only thing that is missing now is the ship applying force on this antenna that is coupled to it.

    my settings: ship apply force 30 toward position (antenna.X, antenna.Y)

  • The official PIN behavior already stores the UID, you can access it as an expression like this

    pinned-object.pin.PinnedUID

  • the uid is not more the problem.

    the only thing that is missing now is the ship applying force on this antenna that is coupled to it.

    my settings: ship apply force 30 toward position (antenna.X, antenna.Y)

  • That is true , though I think rafaelsorgato was trying to go from the Ship to the Antenna, rather than from the Antenna to the Ship. Still, it's a good piece of information to know.

    As for the Antenna physics, rafaelsorgato,

    I might be wrong, but I don think the pin behavior works with the Physics behavior.

    What you might want to do is make the Antenna a non-Physics object, and pin it to the Ship physics object. Then the Ship does all your physics, and the Antenna is just a sprite along for the ride.

    If you need the Ship to break into physics pieces when destroyed, and the Antenna is one of them, then you can replace the live sprite Antenna with a dead physics Antenna at the moment the Ship is destroyed.

    If you really do need the live Antenna to use physics, so it can flex around while the Ship moves, you can try attaching it to the Ship using a physics joint, but if you do, the Antenna will change how the ship controls and moves, unless the Antenna has very low mass.

  • rafaelsorgato

    See this post, it could be relevant:

  • fisholith

    nothing working, but I'll try another way. Do you know how to make the ship force forward? look at the photo, the world has gravity 0, the view is up-down. the ship can rotate.

    https://uploaddeimagens.com.br/imagens/ ... b2f477108c

  • rafaelsorgato

    Physics Apply Force at Angle (Ship.angle)

  • dop2000

    thanks for your reply. i will try it.

  • dop2000

    hi dop, Your code has an error, but thanks to you I got what I wanted.

    thank you, I've been trying for 2 months, and I already tried that, but it did not work, my only mistake was not to put SELF in place of SHIP. Thank you very much!!!

  • olá, galera, acabei de chegar, preciso saber como posso participar do fórum ok?, obg.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Jesinha

    basta falar, kkkkkkk

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