User137 is correct, however, note that you can access elements up to the Capacity, but this might be even worse as you have no idea what they contain (They can contain a destroyed object or even an uninitialized pointer).
You should check the index before accessing the array instead :
Code:
procedure TGameObject.SetAnim(Value: Integer);
begin
_CurrentAnim:=Value; //setting actual animation value
if Animations.Items[_CurrentAnim]<>nil then Animations.Items[_CurrentAnim].Reset; //resetting animation if it wasn't nil so it'll play from start.
end;
becomes
Code:
procedure TGameObject.SetAnim(Value: Integer);
begin
_CurrentAnim:=Value; //setting actual animation value
if (_CurrentAnim >= 0) and (_CurrentAnim < Animations.Coint) then
begin
Animations.Items[_CurrentAnim].Reset; //resetting animation if it wasn't nil so it'll play from start.
end
end;
I removed the check for nil. that should not be necessary if all animations in the animation list is available.
Bookmarks