How do I make moving vehicles collide?

Get help using Construct 2

Post » Sun Mar 12, 2017 10:02 pm

Hello, I am making a tank game and I do no want to make the tanks overlap one another without collisions. I want to have a real solid behavior when the vehicles collide.

When I add the solid behavior to the moving vehicles, they have weird movements. I understand it is due to the behavior working properly for only stationary objects.

So in this tank game. I want to have both a Player vs Bot collision and a Bot vs Bot collision. The player works with car and rotate behaviors and bots work with pathfinding behavior. How can I make collisions for both possibilities (PvB and BvB) with realistic reaction of the vehicle when getting hit?

Note: This is just for moving sprites.

Thanks for the help
B
10
S
1
Posts: 6
Reputation: 462

Post » Wed Mar 22, 2017 5:19 am

one way is to download the LiteTween behavior:
behavior-litetween_p1108989?#p1108989

then when your Player and Bot have a Collision, set Car speed to 0, and Path Find to Stop. Then calculate trajectories.. something like angle(player.x, player.y,bot.x,bot.y) - 180
and use LiteTween and set it to an EaseOut and move them in that direction.

you could do something similar with 8 direction behavior, but getting the angle using Simulate would be kind of a pain.

Regardless, this isn't an easy thing... because you are faking physics.. in order for it to look right, you also probably have to adjust how much you want each sprite to move and take into account, inertia and mass...
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Wed Mar 22, 2017 7:07 am

What is the"realistic" action you want when they collide?

That is usually done by changing animations and using effects.

If you want them to stop or bounce or explode on collision then you play an animation or start an effect when they collide.

They don't have to be set to solid and the collision will still be registered.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830


Return to How do I....?

Who is online

Users browsing this forum: draiza and 7 guests