Dragdrop Question

Get help using Construct 2

Post » Tue Dec 03, 2013 5:59 am

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.




Thanks for your help.producermark112013-12-03 06:31:33
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Tue Dec 03, 2013 10:42 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 03, 2013 11:30 am

Is that the easiest way?

any other easier way to do this?
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Tue Dec 03, 2013 11:39 am

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


I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 03, 2013 11:45 am

oh I'll try that.. I'm a bit new to C2 ... sorry
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Tue Dec 03, 2013 11:57 am

[QUOTE=producermark11] Is that the easiest way?[/QUOTE]without 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.
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Tue Dec 03, 2013 12:01 pm

I would just set it to a Bullet and move toward the purple sprite..
B
45
S
15
G
73
Posts: 2,000
Reputation: 43,382

Post » Tue Dec 03, 2013 12:24 pm

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 ALLproducermark112013-12-03 15:05:33
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Tue Dec 03, 2013 12:27 pm

@LittleStain
@OlivierC
@plinkie

Thanks for your time and help.
B
35
S
10
G
4
Posts: 250
Reputation: 7,908


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, MaujDeveloper and 5 guests