(11-14-2023, 05:12 PM)aliensoldier Wrote: I have created two examples based on the one you have shown me of oop, one with a list and the other without a list
The one that uses the list library works fine, but the one that doesn't use the list library I can't get the trigger to be eliminated when exiting the screen.
I show you the two examples and you can tell me where the error is or you can make a version of your example without using the list library
Sorry for the delay, got busy yesterday, but I've had a look at your code now
I replaced
Code:
free deadList[i]
Code:
free val fatherList, deadList[i]
The new line removes the object in deadList from fatherList. That is, 'free val x, y' removes any occurrence of y from the array/table x and re-indexes the array (removes any holes).
Code:
function Father_Update()
if sizeof(fatherList)
for i = 0 to sizeof(fatherList) -1
fatherList[i].Update()
next
endif
if sizeof(deadList)
for i = 0 to sizeof(deadList) -1
' Marcus
'free deadList[i]
free val fatherList, deadList[i]
next
endif
clear deadList
endfunc
You should never use 'free' when working with arrays. Always use 'free val' (remove any occurrence of a value) or 'free key' (remove an index/key and its value).