how to get array objects deleted properly on collision

23 views
Skip to first unread message

Lewis Lepton

unread,
Apr 18, 2018, 12:30:03 PM4/18/18
to Nape Physics
howdy folks,

so I have been working with nape for some time, but there has been something that has plagued my mind for some time & that is having an array of objects that have a life, & delete once that life has gotten to 0.

I have a player entity & have linked a collision type to the player as well as the the array of enemies.
but what seems to be happening, is that they delete in odd orders. say if im hitting one of about 6, it may delete one across the other side of the screen, rather than the one that im actually hitting.

this is just confusing me beyond belief. as I have the deletion of objects & even with the sprite working completely fine, its just that they dont delete in the right order. im using a while loop as well that has allowed with other projects & shapes to delete in a different order to how they are spawned. but, damn its really not working & I feel at both a loss & completely confused.

ill look to post some code, but its currently a mess & im just starting again for the third time to really understand why this is not working.

if anyone has any pointers, please do share, im just running into complete blanks since I feel I have tried so much.
ive got a feeling its a simple answer & ive just not seen it since ive been looking at the code & methods so much its right in front of me

all the best

Lewis Lepton

unread,
Apr 18, 2018, 2:05:33 PM4/18/18
to Nape Physics
ive just put up a gif to show what is happening. im still trying to work this out & seeing what I can do. also still trying to clean up the code to show the actual code, but may get something up soon

cheers
Large GIF (448x242).gif

Lewis Lepton

unread,
Apr 18, 2018, 2:06:28 PM4/18/18
to Nape Physics
that gif somehow is not working to play. so here is a movie of it
Video MP4 (448x242).mp4

Lewis Lepton

unread,
Apr 18, 2018, 2:33:09 PM4/18/18
to Nape Physics
ah I have just found this. so will have a look-see at that & see if it fits what I need.

Reply all
Reply to author
Forward
0 new messages