Показать сообщение отдельно
Старый 15.07.2011, 08:43   #19
NitE
злобный флудер
 
Регистрация: 10.07.2007
Сообщений: 2,585
Написано 789 полезных сообщений
(для 1,476 пользователей)
Ответ: Удалить объект

Вообщем вот что было у тебя.
Type obj
    
    Field o_type
:String

    
...

    
Method Update() Abstract
    
    
Method Destroy() Abstract
End Type

Type Grass 
Extends obj

    
Function Create()
        
Local NewGrass:Grass = New Grass
        NewGrass
.o_type="Grass"
    
End Function

    ...
    
    
Method destroy()
        
obj_list.remove(Self)
        
GCCollect()
    
End Method

    
...

End Type

Type Player 
Extends obj

    
...

    
Method Update()
        ...
        For 
EachIn obj_list
            
...
            If (
A.o_type="Grass"Then A.destroy()
            ...
        
Next
        
...
    
End Method

    
...

End Type 
А вот так должно быть.
Type obj
    
    Field o_type
:String

    
...

    
Method Update()
        ...
        For 
EachIn obj_list
            
...
            If (
A.o_type="Grass"Then A.destroy()
            ...
        
Next
        
...
    
End Method
    
    Method destroy
()
        
obj_list.remove(Self)
        
GCCollect()
    
End Method
End Type

Type Grass 
Extends obj

    
Function Create()
        
Local NewGrass:Grass = New Grass
        NewGrass
.o_type="Grass"
    
End Function

    ...
    


    ...

End Type

Type Player 
Extends obj

    
...



    ...

End Type 
(Offline)
 
Ответить с цитированием