Dragdrop Question

0 favourites
  • 9 posts
From the Asset Store
Logo Quiz with 150 prepared logos and answers, automatic question and answer mixing
  • Hi all,

    I've been trying this for 2 hours trying to figure out ..

    I'm having a brain fart here, hope you can help.

    With drag and drop.

    I can do the when overlapping part ..NO problem there...

    THE PROBLEM IS when its not overlapping I want a smooth movement to purple sprite.

    Problem:

    Arrow/ On Dragdrop drop / is NOT overlapping brown sprite / I want the arrow ( without changing the angle)

    to smoothly move and 'lock on' to purple sprite.

    I can position there now but its is instantly, not smooth at all.

    Do I enable a bullet behaviors to move there smoothly .?

    oh, and I don't want to change the angle of the arrow please..keep at the current angle (arrow pointing to left as well) .. please

    How?

    If possible, post a capx please.

    Thanks for looking / Thanks for helping. Much appreciated.

    <img src="https://dl.dropboxusercontent.com/u/139486255/Image/slider.jpg" border="0" />

    Thanks for your help.

  • I would create a group called FalseDrop.

    on drag and drop drop is not overlapping - set group FalseDrop to activated

    and in the group:

    arrow is not overlapping purple

    -arrow set x : lerp(arrow.x,purple.x,0.5*dt)

    -arrow set y : lerp(arrow.y,purple.y,0.5*dt)

    arrow is overlapping purple set group FalseDrop deactivated

    ofcourse you'd have to play with the value of 0.5*dt to find out which speed you'd like.

  • Is that the easiest way?

    any other easier way to do this?

  • I don't see what is hard about my way..

    Easiest way would probably be using the moveto plugin from the plugin section. That way you don't have to think at all. Just set moveto destination to purple.x,purple.y

  • oh I'll try that.. I'm a bit new to C2 ... sorry

  • Is that the easiest way?ithout plugin, yes. If you really want to use a bullet behavior, set the bullet properties "Set angle" to No and "initial state" to disable. Then in the Drop event, use the action "Set angle of motion" to angle(Self.X,Self.Y,purple.x,purple.y) and enable the behavior. Then create an event for when the arrow overlap the purple square where you disable the behavior. You can also disable the dragdrop behavior when you enable the bullet, and reenable it when it overlap the square, this way user cannot try to grab the arrow while it's moving. Or you can allow it and cancel the bullet in the drag start event.

  • I would just set it to a Bullet and move toward the purple sprite..

  • SOLVED

    but if others have a capx example with a different way to do this .....

    by all means post..

    Thanks all

    The MoveTo behavior (plugin) worked so easy !

    Put in Behaviours not Plugins Folder

    For those who want it:

    MoveTo

    http://www.scirra.com/forum/behavior-moveto_topic44845.html

    How to install plugins:

    http://www.scirra.com/forum/how-to-install-plugins-and-behaviors_topic45737.htmlTHANKS ALL

  • Try Construct 3

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

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

    OlivierC

    Thanks for your time and help.

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