2017-11-04 12:18:25

Hi guys!
I have a question.
For example, I have an enemy class in BGT.
But how to make the removal of the enemy?
The question arises 2:
1. What should I write in the distructure?
2. How to cause the distructure.
Please show examples.
Thanks in advance!

2017-11-04 19:05:39 (edited by brian.kurosawa 2017-11-04 19:05:59)

If you use a looping sound on the sound pool, keep it on a int variable so when you call the destructor you destroy that sound as well. For destroying enemies you may create an array with the enemies on the map and remove it when he's dead.

2017-11-04 19:46:31

does remove_at remove the enemy? And if the enemy is one, just for example. And when the destructor is started. How to destroy an object

2017-11-05 03:23:23

Remove_at will remove the handle referencing that enemy on the array. If there's no handles referencing it, the destructor is called and the object destroyed.

2017-11-05 12:01:38

If the enemy is created in one object. If not an array. How to delete?

2017-11-05 23:09:42

Set the pointer to null, for example: Enemy handle; @handle=null;