How do I make moving vehicles collide?

0 favourites
  • 3 posts
From the Asset Store
252 high-quality futuristic vehicle engine sound effects.
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • one way is to download the LiteTween behavior:

    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...

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)