How do I best handle collisions between 2 players?

Get help using Construct 2

Post » Tue May 03, 2016 11:10 pm

I was told that the Physics behavior is not great on mobile. Especially with several other physics objects on screen (all moving).

Using the 8 Direction movement behavior - is there a better way to handle collisions between 2 players (so that they cannot overlap each other). I'd prefer it if a player was trying to move in a direction and another player was in the way, then the moving player "pushes" the other player slowly.

This is doable with the Physics behavior, but is this the best way to go - Even if it harms performance? - My concern being that I don't really need "physics" in my game other than that instance where two players collide and shouldn't overlap, so I fear that it may not even be worth adding, unless I am thinking too much and the performance difference is minimal (I plan on having several players on screen at once, and the game will likely run on mobile).

Thanks for any input that you can provide.
B
64
S
21
G
7
Posts: 74
Reputation: 7,477

Post » Wed May 04, 2016 4:23 am

Try the custom movement behavior - there is a "push out solids" action you can use. You can use this in addition to your physics or 8 direction behaviors, along with the solids behavior.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Thu May 05, 2016 2:29 pm

Push out solids doesn't work well with two moving objects. It looks far too glitchy on contact the objects warp randomly around each other
B
64
S
21
G
7
Posts: 74
Reputation: 7,477

Post » Thu May 05, 2016 5:36 pm

Push out solids at angle gives you a little more control.

How fast are your players moving, in terms of how many pixels might they overlap on the collision frame? Also are your players irregular shapes?

Try testing your game with physics on the target device, you might not even have anything to worry about. Preview over lan is a feature to help you easily test on mobile.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests