how can I move a object inside the outline of other objects

0 favourites
  • 11 posts
From the Asset Store
94 Inside buildings views - Isometric view - PNG transparent - 2048x2048
  • how can I use the drag and drop behavior, to move a ocbjeto around the contour of another object? Imagine a square with only the color outline and inside unfilled. how can I make an object with behavior drag and drop to move only around the square without leaving the contour. I wish with this same logic, be applied if the cube was moving during the drag and drop, and I could use sprites with complex shapes like the outline of a star shape. imagine a hexagram, making for an object with the behavior drag and drop to move for each star line segment as the player podesse draw it

  • You can do something like this:

    Sprite1.X<Sprite2.BBoxLeft+Sprite1.Width/2--->Sprite1 Set X to Sprite2.BBoxLeft+Sprite1.Width/2

    Just add 3 more conditions for right, top, bottom with appropriate values.

  • You can do something like this:

    Sprite1.X<Sprite2.BBoxLeft+Sprite1.Width/2--->Sprite1 Set X to Sprite2.BBoxLeft+Sprite1.Width/2

    Just add 3 more conditions for right, top, bottom with appropriate values.

    One event with two actions will do:

    every tick

    sprite1 set x = clamp(sprite1.x,sprite2.bboxleft+0.5*sprite1.width, sprite2.bboxright-0.5*sprite1.width)

    sprite1 set y = clamp(sprite1.y,sprite2.bboxtop+0.5*sprite1.height, sprite2.bboxbotto-0.5*sprite1.height)

  • LittleStain thanks! I'm constantly learning a lot from you and it always amazes me how you can find the best solutions to problems. You have my deepest respect!

  • LittleStain thanks! I'm constantly learning a lot from you and it always amazes me how you can find the best solutions to problems. You have my deepest respect!

    Thanks..

    Nice to hear..

    Especiallly today (Birthday)

  • Well, happy birthday to you my friend!

  • Thank you very much immortalx and LittleStain. Very grateful for the help.

    I will test and then write the result

  • LittleStain

    The move was perfect it moves the boundary! Is there a way to enable and disable the subject's with drag and drop behavior not move the center of the second object, move exactly at the edges? I could put an object inside and obstacle, but as I will create many objects in the layout I think I can lose performance.

    I managed to make the move in the circle, but I would make the same objects with complex contour.

    https:// dl.dropboxusercontent.com/ u/191465830/Manivela%202 /index. html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That is a completely different question..

    One way might be using a single tiled-background-object for all the borders and keeping the object overlapping that..

    I can think of other ways using multiple imagepoints

    Really depends on what you are aiming to do..

    circle dragging is actually pretty easy as is dragging at the edges of squares..

  • LittleStain

    Technically, I want to play use the touch screen, skirting the object as if it draws them.

  • Ok, so the tiled-background option should work..

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