Ninjadoodle Posted March 22, 2018 Share Posted March 22, 2018 @enpu I'm removing sprite created from a class, but my bullet still gets destroyed, when it touches the place where the enemy was destroyed previously. Quote Link to comment Share on other sites More sharing options...
enpu Posted March 22, 2018 Share Posted March 22, 2018 @Ninjadoodle You class probably has update function? You need to make the scene not to call that function anymore, can be done by calling game.scene.removeObject(this); inside your class. remove: { this.sprite.remove(); this.tween.stop(); game.scene.removeObject(this); } Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted March 22, 2018 Author Share Posted March 22, 2018 @enpu The enemy has no update, just tweens ... The laser the is testing against the enemy array has an update. I tried game.scene.removeObject(enemy) in the lasers hitTest but doesn't seem to work Quote Link to comment Share on other sites More sharing options...
enpu Posted March 22, 2018 Share Posted March 22, 2018 @Ninjadoodle Ah well then you probably need to remove the enemy from the array. There is helper function in Array called "erase" which you can use to erase one item from array, for example: var enemy = new game.Enemy(); var enemies = []; enemies.push(enemy); // Push to array enemies.erase(enemy); // Remove from array Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted March 22, 2018 Author Share Posted March 22, 2018 Hi @enpu That did the trick, thank you for the tips! I'm thinking I might have to finish this project in Construct, as I have it half done already. Panda is the BEST engine I've used, but I'm finding it really hard to find the time to learn the ins and outs of 'coding', and its really taking me away from getting stuff done. I have a few projects lined up where I'd like to use Panda, but I don't know if I have the time right now to work through all my 'problems'. Again, Panda is the most flexible / best engine I've used - I just don't know if I have the time right now to invest into doing stuff 'properly'. I'd love to slap the game together somehow, but I feel like I'm constantly asking questions and holding you up from developing the engine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.