I had a short look now, and I'm a bit confused ![Smile Smile](https://www.naalaa.com/forum/images/smilies/smile.png)
Let's focus on the main file, example-father, for now:
Here you create a new father object every time you call Father(), which is a bit "strange" and not optimal.
The problem is that you have made the "base class", Father, serve as a sprite manager. If I were you, I would remove the functions Add, Update_all, Draw_all, Destroy and Clear from Father and put them in regular functions, or create another "class" (a sprite manager) whose only job is to manage a list of sprites.
I've attached a new example-father.n7 and father1.n7 where I've made the change that I suggested. Every function that deals with the sprite list (fatherList) are now regular functions. I didn't remove the functions from the father "class", but they now call the independant functions.
![Smile Smile](https://www.naalaa.com/forum/images/smilies/smile.png)
Let's focus on the main file, example-father, for now:
Code:
while not keydown(KEY_ESCAPE,true)
set color 0,0,0
cls
'--------------------------------------------------
Father().Update_all()
Father().Draw_all()
'eliminar todo
if keydown(KEY_X,false)
Father().Clear()
endif
'--------------------------------------------------
redraw
fwait 60
wend
Here you create a new father object every time you call Father(), which is a bit "strange" and not optimal.
The problem is that you have made the "base class", Father, serve as a sprite manager. If I were you, I would remove the functions Add, Update_all, Draw_all, Destroy and Clear from Father and put them in regular functions, or create another "class" (a sprite manager) whose only job is to manage a list of sprites.
I've attached a new example-father.n7 and father1.n7 where I've made the change that I suggested. Every function that deals with the sprite list (fatherList) are now regular functions. I didn't remove the functions from the father "class", but they now call the independant functions.