How does overlapping work?

Get help using Construct 2

Post » Fri Aug 24, 2012 11:39 am

Good Morning All,

I have an object that has bullet motion and moves in a straight line from left of the screen to right. I would like object1 to change direction when it overlaps object2 100% (they are both the same size) but I can't get it to work. If I choose object1 overlapping object2 then set angle, object1 changes direction the moment they touch but I need it to be when they are completely overlapping.

I tried to round the X's and Y's and that allowed object1 to change direction most of the time (It still didn't work every time)

I then tried something different:

If object1 X and Y = object2 X and Y then set angle.

Object1 just kept going. I set text items to the X's and Y's and I believe the problem is the motion of object1. It's X is never exactly the same as object2.

Does anyone have any other ideas?
B
25
S
8
G
6
Posts: 35
Reputation: 4,905

Post » Fri Aug 24, 2012 11:50 am

Similar to what you just tried, try a small adjustment as a temp fix.

If Object1.X > Object2.X + 5
   Object1.X < Object2.X - 5       Then set angle.

I know construct doesn't always = an exact number when objects are moving, so set a small segway for it to use instead.

Hope this solves the problem, or brings someone nearer an answer
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Fri Aug 24, 2012 11:56 am

Another simple idea to try and achieve what your after could be Overlapping at offset option.
You might be able to achieve the effect you desire using this option rather then a normal overlap?
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Fri Aug 24, 2012 12:04 pm

B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, randomly, spcsmrf and 27 guests