How do I make a destructible ground for my tank game? (Physics behavior)

1 favourites
  • 10 posts
From the Asset Store
Tanking Tanks
$20 USD
80% off
Try to destroy your enemies in a hard battle! Good luck!
  • Hello! I'm making a tank game, where you have to select a weapon according to the occasion and destroy your enemies. Basically is that. One of the fundamental mechanics is destroying the ground. The whole game has physics behavior, and the best solution (the only) I found was making a ground object of 5 x 5 pixels and create a grid multiplying it. That's the result:

    It worked, but I know, there are too many objects on layout, the performance is very poor. Considering a tile background doenst work for it (because when the projectile touch the ground, it destroy the whole ground, is there any more ellegant solution?

    Please help to achive a better way to do it. Thanks! :D

    Tagged:

  • You’d get better performance with a tilemap instead of multiple sprites. There are a few examples on the forum you can find with search.

  • You’d get better performance with a tilemap instead of multiple sprites. There are a few examples on the forum you can find with search.

    Is it possible to destroy only the tiles on collision with the projectile instead the whole tilemap? How?

  • Thank you! I'll check it out and send a feedback soon!

  • UPDATE:

    I've done! I made a test .capx and the erase tilemap solved my problem.

    Now I need to learn how to set the tilemap in complex shapes and how to make a circunference at erase tilemap function.

    PS: Is there no problem about mixing platform, solid and physics behaviors? It's working well, but... Idk

  • It depends on how you are using Physics, but generally it's not recommended to mix Physics with other behaviors. Especially when it comes to moving Physics objects - you should only do this with Physics actions, like apply force/impulse/velocity.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It depends on how you are using Physics, but generally it's not recommended to mix Physics with other behaviors. Especially when it comes to moving Physics objects - you should only do this with Physics actions, like apply force/impulse/velocity.

    I'm follwing those rules. My actual problem is: there's a projectile that works like a granade. You lanch it using 'impulse at angle' and it explode when it's sleeping. It has to bounce on the ground, but now, my ground is a tilemap, and the granade just pass through the tilemap!

    For projectile that doesnt need to bounce, my project is ok. It collides with tilemap and destroy itself and erase the a range of the tilemap. However, projectiles that need to bounce on ground can't work properly.

    Help!

  • You can try Bullet behavior for the projectile, with gravity and bounce off solids. Or apply Physics behavior to the tilemap, set it immovable, but I don't know how well will it work. You can also try Chipmunk:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-chipmunk-physics-82151

  • dop2000

    Thanks a lot! It worked!!

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