No, function that is used is TGameObject.isColliding(GO:TGameObject). But thanks for suggestion, will try to check that.
No, function that is used is TGameObject.isColliding(GO:TGameObject). But thanks for suggestion, will try to check that.
Nope, checked if it is in range and still segfaults.
Are you sure CurrentSprite is a valid index?
You should not do this, , but try this, it will avoid anything wrong :
Code:function TGameObject.isColliding(Sprite: TSprite): Boolean; begin Result:=false; //setting result, just in case if (not Assigned(self)) or (not Assigned(Sprite)) then Exit; case ObjectMode of omAnim: begin if (CurrentAnim>0) and (CurrentAnim<=Animations.Items.Count-1) then if Assigned(Animations.Items[CurrentAnim]) then //safety check so we won't get segfault //setting result Result:=Animations.Items[CurrentAnim].IsColliding(Sprite); end; omSprite: begin if (CurrentSprite>0) and (CurrentSprite<=Animations.Items.Count-1) then if Sprites.Items[CurrentSprite]<>nil then //safety check so we won't get segfault //setting result Result:=Sprites.Items[CurrentSprite].IsColliding(Sprite); end; end; end;
Cezar Wagenheimer from Green Sauce Games
Programmer of Druids - Battle of Magic, Abra Academy, Abra Academy - Returning Cast, Rabbit Jump, Dreams of a Geisha and Heroes from the Past: Joan of Arc
Wagenheimer's Game Development Blog
Had another quick look on the github. Are you calling right constructor for TAnimatedSprite?
the .Create is TObject.Create, it seems. The .Create without parameters is not written to either TAnimatedSprite or TSprite.Code:constructor TGameObject.Create(mode: TObjectMode); begin if mode=omAnim then Animations:=TAnimatedSpriteList.create;
Last edited by User137; 18-07-2013 at 03:49 PM.
*TAnimatedSpriteList. And for a while I've thought you're right, but TAnimatedSpriteList.create is defined on line 186 of Sprites.pas.
Anyway, it then would crash as soon as I'd enter TDebugState since collision is checked constantly and thus Animations is accessed constantly and it only crashes if I make both game objects touch each other.
It may be something with TAnimatedSprite class though.
Any help? I can't pinpoint the issue at all!
Bookmarks