we have deleted with for loops. but we do something much better using while loops.
starting with a new project, we copy our entity class from our previous '080_centerPosition' project & updated it.
then making a player class which extends with our entity class.
coding an array of players, then 3 functions: one to create, one to delete & the last to make a type of border our player array will delete itself once passed.
we then lastly update our movement, render & make sure we can use our mouse to create & delete players in the array.
now we can delete any entity in any order no matter what, making this a much better option for handling deletion of entities
source code:
https://github.com/lewislepton/kha-tutorial-series
commit source:
https://github.com/Kode/Kha/tree/3c3d766dfef023149d5bc40d92045780fa241651
SUPPORT ON PATREON FROM AS LITTLE AS $1:
https://patreon.com/lewislepton
intro & outro music is from this EP:
https://lewislepton.bandcamp.com/album/coat-noise-ep
like, share & subscribe to stay up to date.
https://lewislepton.com
https://patreon.com/lewislepton
https://twitter.com/lewislepton
https://facebook.com/lewislepton
https://lewislepton.bandcamp.com
https://soundcloud.com/lewislepton
https://github.com/lewislepton