How do I Set Drag Bounds for a Sprite?

Get help using Construct 2

Post » Mon Jan 19, 2015 5:17 pm

EDIT: Updated desryption witha gif to show what I need
Image
-------------------------------------------------------------------------
Let's say I have several instances of a single Sprite. I drag any of the objects. When a dragged object collides with another one it can't pass through but is still draggable.

This is what I want. Anyone knows a trick or two?
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 6:03 pm

Bump with a better description.
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 7:02 pm

Add Touch behaviour
Add solid behaviour to the green blocks
Add drag & drop then add platformer behaviour to the black blocks
set platformer gravity to 0

And you are all set
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Wed Jan 21, 2015 7:19 pm

Awesome, thanks! One last question: if the black block is green too, does the same setup work?
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 7:25 pm

Btw just tried your suggestion! Unfortunately it causes the platfrom sprite to jump around solid blocks hysterically when you try to drag the platform sprite further.
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 9:17 pm

Unfortunately no, solid can't detect another solid, unless you applied physics.
You can limit the black block movement using clamp. I think I'll showcase it by create the sample for you.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Wed Jan 21, 2015 10:03 pm

Thanks a lot, man, that would be really great!
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Thu Jan 22, 2015 7:01 pm

Here the example to play with:
You do not have the required permissions to view the files attached to this post.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Thu Jan 22, 2015 8:16 pm

Awwwww dang it's almost the thing I need! : D

I should say dragging with obstacles not with boundaries, so generally you could drag the black box freely but it coudn't go through green boxes! Sorry I understood it only after you put out the .capx.

But this .capx is very useful too, say, it's a good go in some GUI stuff or special gameplay schemes!

Would be cool to see if it possible to make black box drag like that!
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Thu Jan 22, 2015 8:49 pm

Made a small workaround, not sure it's ok though, better versions are welcome!
You do not have the required permissions to view the files attached to this post.
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Next

Return to How do I....?

Who is online

Users browsing this forum: boybacteria, dop2000, Microbex and 38 guests