how to make collition between 2 sprites (couldent find tut)

Just started using Construct 2? Post your questions here

Post » Wed Jul 01, 2015 3:40 pm

hi everyone. i tried to find tutorials about how to make collision between 2 sprites. can someone tell me how to do that or give me a tutorial?
B
8
S
3
Posts: 100
Reputation: 1,023

Post » Thu Jul 02, 2015 2:56 pm

Every object you create on the layout has a collision box, you can edit the size and shape of the collision box of the sprite objects.

You use collisions to trigger events. Enemy on collision with player triggers damage.. or anything like that.

Try reading the manual: https://www.scirra.com/manual/121/event-sheets
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Fri Jul 03, 2015 1:50 pm

I think you can also add a behavior that will make it solid, so nothing can pass through it. It should be in the attributes if needed :)
The collision box is editable and there are events "on collision" so you can decide what happens when the two objects touch :)
B
8
S
1
Posts: 16
Reputation: 602

Post » Fri Jul 03, 2015 3:23 pm

RayKi wrote:Every object you create on the layout has a collision box, you can edit the size and shape of the collision box of the sprite objects.

You use collisions to trigger events. Enemy on collision with player triggers damage.. or anything like that.

Try reading the manual:



i didnt succes to do it. if its not clear i just want the player object wont pass through the wall object. (in top down shooter game)

for example if i have 2 sprites: player , wall

i wrote in the event sheet: player- on collition with another object (i chose wall) - add collitions enbaled

and it didnt work.

so i wrote in the event sheet : when start of liyout set player solid behaviour enbaled
and when start of layout set wall solid behaviour enbaled

and it didnt work too.
B
8
S
3
Posts: 100
Reputation: 1,023

Post » Sat Jul 04, 2015 12:55 am

You don't need to add a event for that. Just add the solid behavior to both player and wall sprite and they won't move past each other.

If you set both behaviors and it's still not working try cheking if the player is not moving too fast. Moving too many pixels per second may make the player pass through thin objects.

But if you try all this and it's still not workig try to upload your .capx file so qe can take a better look on what you're doing
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Sat Jul 04, 2015 7:26 am

RayKi wrote:You don't need to add a event for that. Just add the solid behavior to both player and wall sprite and they won't move past each other.

If you set both behaviors and it's still not working try cheking if the player is not moving too fast. Moving too many pixels per second may make the player pass through thin objects.

But if you try all this and it's still not workig try to upload your .capx file so qe can take a better look on what you're doing



thank you for the help. becouse the forum rules i cant send you the file. can i send it to you on your site? (ray-ki.deviantart.com)
B
8
S
3
Posts: 100
Reputation: 1,023


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest