Touch controls & Collision

Get help using Construct 2

Post » Fri Jan 25, 2013 7:41 pm

Hello. I'm new to Construct2 and I'm trying to make a mobile game where you control 2 players via the touch controls. I've got it working so when you are touching the player it'll move its X position to the Touch.X position. The problem I'm having is that you don't stop when you collide with the second player, instead you just pass right through which causes problems because it then stacks them both on top of each other and moves them both at the same time. How can I set it up so when they collide with each other they stop moving or repel from each other or something? Thanks!
B
3
Posts: 4
Reputation: 433

Post » Sat Jan 26, 2013 12:37 am

You can easily setup an event for on collision with player2 and do the same for the other player. At that point you can make them react any way you want.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Sun Jan 27, 2013 12:31 pm

OK, so I've found the collision events but how can I make them stop when they collide with each other since they're not technically moving (just being re-positioned). So like how can I stop it from re-positioning them on top of each other or like when they collide it releases the touch controls so they stop moving or something? Thanks.
B
3
Posts: 4
Reputation: 433

Post » Thu Jan 31, 2013 3:21 pm

Anyone?
B
3
Posts: 4
Reputation: 433

Post » Thu Jan 31, 2013 3:27 pm

Why don't you use move commands, instead of manually setting the position every tick?

Set up a custom movement behaviour and use that to move them to your touch locations, then give them an on collision event that tells them to stop when they bump into each other.

Alternatively, set your entire "on touch do move" event to be conditional that the two sprites are not overlapping.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, Nifl and 25 guests