How do I setting drag drop border

0 favourites
  • 6 posts
From the Asset Store
320 high-quality cinematic sound effects for trailers and game scenes.
  • I have an object that I drag with drag drop and I create a new object in the middle of this object, but I want to set certain limits in the drag drop event.

    Object number 1 must fall into the walls I indicated in number 3 and I drop object number 1 by moving the blackness number 2 left and right

  • So object #1 should be dragged by simply touching anywhere on the screen, right?

    If #2 is a large invisible background sprite with Drag and Drop behavior, then on drag start you can attach #1 to #2 as a child with hierarchy. Then #1 will move with #2. On drop - remove the hierarchy.

    And while dragging limit the position of #1:

    Object2 On Drop
    OR Object2 is dragging : Object1 set x to clamp(self.x, left_border, right_border)
    
  • I couldn't do what you said, actually I found a method like this, but here if you play from the desktop etc. then it goes out of the limits I have drawn.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Perhaps you need to use other values instead of ViewportLeft and ViewportRight

  • Perhaps you need to use other values instead of ViewportLeft and ViewportRight

    Yeah, but I couldn't figure out what to use either :(

  • Use the border coordinates. If your border is a sprite, you can use Border.X or Border.BBoxLeft, Border.BBoxRight

    Or simply fixed values:

    Sprite is dragging: Set x to clamp (self.x, 200, 400)

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