scofieldly Posted November 1, 2016 Share Posted November 1, 2016 Hi guys, I want to make a sprite pool for make bullet in the game, when I kill the bullet sprite, I found the update function is still running, so I wonder is there any way to stop the update function, actually I want to make a new update function when I get it from the pool. thanks. Link to comment Share on other sites More sharing options...
Alamantus Posted November 2, 2016 Share Posted November 2, 2016 If the same bullet is not going to be re-used again later, it should be removed from the game using destroy() instead of kill(). This will remove the bullet from the game, which would definitely stop the updating. To answer your question directly, though, in your update function, you can check the bullet's sprite for its alive property before running its update. All kill() does is set a few booleans to false so the sprite will stop displaying, not remove anything: Sprite.kill() docs scofieldly 1 Link to comment Share on other sites More sharing options...
scofieldly Posted November 10, 2016 Author Share Posted November 10, 2016 On 2016/11/2 at 9:13 PM, Alamantus said: If the same bullet is not going to be re-used again later, it should be removed from the game using destroy() instead of kill(). This will remove the bullet from the game, which would definitely stop the updating. To answer your question directly, though, in your update function, you can check the bullet's sprite for its alive property before running its update. All kill() does is set a few booleans to false so the sprite will stop displaying, not remove anything: Sprite.kill() docs thanks alamantus Link to comment Share on other sites More sharing options...
Recommended Posts