#4 | 20-07-24 | Object Destruction


Hello!

Todays task is object destruction, removing unnecessary game objects from the scene.

To destroy the unnecessary objects, I created a script and boundary game objects with colliders.


When a projectile or target collides with the boundary game objects, it is destroyed. To achieve this, I used a function called OnCollisionEnter2D. When an object with a 2D collider collides with another object with the same collider, this function is called.

Having boundary game objects and a separate script to handle collision and destroying unnecessary objects allows me to leave the projectile and target movement scripts as minimal as possible.

With object destruction finished, the next tasks are creating the score counter and a time limit.

Thanks for reading!

Get Hit That Target!

Leave a comment

Log in with itch.io to leave a comment.