How do I do a bound to object ?

Get help using Construct 2

Post » Tue Jan 31, 2017 4:08 pm

Hello !

I have an object overlapping an other one and it absolutly needs to stay in this condition, but I don't know how to do this.

To illustrate it properly, I would like to adapt the " Bound to layout " behavior to a bound to object.

Regards.
B
5
Posts: 30
Reputation: 291

Post » Tue Jan 31, 2017 4:53 pm

did you try the Pin behavior?
B
97
S
32
G
15
Posts: 1,198
Reputation: 16,178

Post » Tue Jan 31, 2017 5:31 pm

Yeah I've tried and it doesn't show the result I want. My overlapping object has to move "inside" the overlapped, and pinning it would stop any movements.
B
5
Posts: 30
Reputation: 291

Post » Tue Jan 31, 2017 8:04 pm

oh I understand now, you want it to move within that other sprite.

I work it the same way you can code "Bound To Layout" with the behavior. Just keep testing for when it's not overlapping and when it isn't return it to where it was last overlapping. Look into overlapping at offset. It probably depends on how exact you want to be and how big your bounding sprite is..
B
97
S
32
G
15
Posts: 1,198
Reputation: 16,178

Post » Tue Jan 31, 2017 8:18 pm

How do exactly do you move it ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jan 31, 2017 10:15 pm

I've found an other way to do it, and it simplify my next iteration of the work. I've just put simple cases into the sprite and the sprite that has to move just go onto the cases, so it can't move out of it.

But in the first place I was moving it by adding X pos + sprite size to the new X pos till it is overlapping. But the way I need to use it, it wasn't appropriate in the first place.
B
5
Posts: 30
Reputation: 291


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests