attach object

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • how can i attach object1 to another2

    but object1 will be at the point where i placed it (it can be different every time)

    and it will rotate and move with object2


    that i can attach this object multiple time in different points

  • Use the Image Point tool in the image editor to place some image points, then you can position other objects to these image points.

  • i know but i dont want the object1 will be on image point

    cuz the object1 can be on any position on the screen

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • use the stick method first pioneered by lucid in a thread about a 2d katamari damacy clone

    in the following cap you can see it in action, it's not nearly as confusing as it sounds or looks

    you don't need as many events as I have there, so try to figure out what they're each doing

    I only put so many so you can see that it works in all situations

    drag and drop the green or blue boxes

    and hold the right mouse button to stop the green one from rotating, and rotate the blue one

    in your actual cap, you'll obviously make the line sprite invisible

    (saved in 99.3)

    you make a sprite of horizontal line with the hotspot at the very left, and an imagepoint at the very right

    then when it's time to stick an object B to object A

    you set the line position to Object A position

    set line width to distance(objecta.x,objecta.y,objectb.x,objectb.y)

    and set angle of the line sprite to angle(objecta.x,objecta.y,objectb.x,objectb.y)

    and set a private variable ORIGLINEANG to linesprite.angle-objecta.angle

    and set a private variable ORIGANGB to objectb.angle

    then you 'Always' set line sprite position to object a position, and 'always' set object b position to line position at imagepoint 1

    always set line angle to objecta.angle+ORIGLINEANG

    and 'always' set angle of objectb to objecta.angle+ORIGANGB

  • its work but still i cant add the same object in other place

  • you have to make events to add a line and an object each time you need it done

    there's no reason this shouldn't work with multiple objects

    use the object pairer or groups to keep each line and sprite aligned with eachother

  • i mean spawn the same object multiple times

    and every piece by itself

    and some how its now working for me

    when i did this on my game :\

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