Games Achievements My Kong Sign In

Sackzement's Comments

Comment

Shootorial #5

Play Shootorial #5

Sep. 17, 2010

Rating: 1

I added a function in the EnemyShip class, which removes the EnemyShip from the enemies array in the Ship class, when it is destroyed or moves out of scope. This can make a difference in performance if you use big arrays. Here' the function: function removeFromArray() { for(var i in _root.ship.enemies) { if(this == _root.ship.enemies[i]) { _root.ship.enemies.splice(i,1); } } } Add it somewhere in the EnemyShip class and execute it when the ship is destroyed or moves left out of the stage.The splice(a,1) function removes 1 object on the a-th position from an array. Since I'm new to Flash a pro should take a lot at this and correct me if I'm wrong.

Developers Players Support YouTube TikTok X (Twitter) LinkedIn
Join the conversation Join Discord
Terms of Service Privacy Policy Code of Conduct
© 2026 Kongregate