2D Collision and AI

Nov 14, 2011 at 11:20 AM


Is it possible with the current version of IGF to perform collision checks between 2D sprites? If so, is it built into the Sprite classes or would I have to use the Physics part of the framework to do this?

On a seperate note, can the AI parts of the framework be used in a 2D based game? My initial thoughts are I could by ignoring the Z value and setting this to zero.

Many Thanks


Nov 14, 2011 at 11:33 AM

Hi Sid,

Yes, IGF 2D SpriteObjects work with the SunBurn Collision system and should probably work with the BEPUPhysics system too (while I didn't test it yet).
However, there isn't yet any per pixel collision system (only box and sphere).

As for the AI, yes, you can use the AI parts for a 2D game. You'll just have to ignore one of the 3 axis values in your computations and/or cast the Agent.ParentObject to a SpriteObject to access its 2D properties (Vector2 position, scale, etc...).