How to check who's object collides and change frame?

Discussion and feedback on Construct 2

Post » Mon Dec 21, 2015 10:11 am

Hi,

How to change the frame of two objects when it collides each other?

Thanks.
B
23
S
6
G
3
Posts: 39
Reputation: 4,759

Post » Mon Dec 21, 2015 10:35 am

If they are different object types you should be able to check collisions separately, or pick the colliding object by getting the first instance (0). If the objects are of the same type it gets a bit more tricky.

https://www.scirra.com/forum/check-vars-when-instances-of-same-object-collide_t83220
B
6
S
2
Posts: 15
Reputation: 589

Post » Mon Dec 21, 2015 11:28 am

Let's say you have two Sprite objects called A and B. On the event sheet you make an event for A object: On collision with B. Then you add the Set frame action for A and/or B objects to that event. Since a collision picks the two instances taking part in the collision, you can set their frame just by checking the collision and using the set frame action.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,715

Post » Tue Dec 22, 2015 6:38 am

Thanks @rf900 and @glerikud. Appreciated.
B
23
S
6
G
3
Posts: 39
Reputation: 4,759


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests