Make a DragDrop Behaviors Scope?

0 favourites
  • 4 posts
  • Hi,

    I am make some object can Drag Drop in my game

    However,It can move everywhere in layouts <img src="smileys/smiley6.gif" border="0" align="middle" />

    How to set move Scope?

    Thank

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi blueman321,

    All you need to do is add 'Drag & Drop' behaviour to the objects you want to move around. I've added a simple example (DragDrop.capx).

    If you want to limit its movement to certain areas, just use this example by Yann (limited movement example)

    Hope that helps :)

  • Thank Blacksmith,

    (Sorry for my poor English)

    I am reference the limited movement capx,

    but it have lot of bug of my game.... <img src="smileys/smiley11.gif" border="0" align="middle" />

    I want to create Scope without extra object,

    I change the expressions:

    clamp(self.X,square.BBoxLeft+self.Width/2,square.BBoxRight-self.Width/2)

    To

    clamp(self.X,self.X-20,self.X+20),But it is not work

    It is wrong at first(self.X)

    How can I get the original X of object ?

  • blueman321,

    Not sure I fully understand what you want to do. If you are moving your object, then its self.X will always be changing, so it wouldn't be very useful to use that within the expression.

    If you want to limit the movement of your object to just +/- 20. You could still use Yann's example. Just create an invisible sprite/box, which is 40 pixels bigger than your object. Then use the clamp expression from the example.

    Edit: If you want to record the original x of your object, you can put the value into a variable. Then use that var as a reference for objects original position.

    But I think Yann's method would work best.

    <img src="smileys/smiley1.gif" border="0" align="middle" />

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