I want to delete a sprite from my sprite array and I tried myPlane.bullets[index].destroy() and myPlane.bullets.shift():
for (let index = 0; index < myPlane.bullets.length; index++) {
if(myPlane.bullets[index].y < -bulletHeight) {
// step 1
myPlane.bullets[index].destroy()
// step 2
myPlane.bullets.shift()
continue
}
myPlane.bullets[index].y -= bulletSpeed
}
but I think that's not the best way to delete a sprite in an array, it is too fussy.