Actors_________________________________________________
  • TPGActors - Are the base objects that can exist and have interaction in the game world.
  • TPGActorList - Is a dynamic double linked list that Actors can live on. An ActorList can process collisions which will call the Actors OnCollide method.
  • TPGActorScene - Is a object that handle multiple ActorList objects. For example, rather than having one list that has to check collisions against objects that will not collide, you can have multiple lists, one for particles, one for enemies and one for the player. The idea is that you will normally never do collision check for particles so keep them on a separate list making making the collision check more efficent.
  • TPGAIState - The AI system in PG is based around an event driven state machine and TPGAIState is an object that represents this logical state.
  • TPGAIStateMachine - Is an object that manages all the AI states. It can changes states, got back to the previous state, have a global state that can run in parallel with the current state and so on.
  • TPGAIActor - Is an actor that has a state machine to manage it's states.
  • TPGEntity - Is an AIActor that can exist in the game world, it has shape (based on sprites), position, can do collision, can be animated so on. You will use an entity most of the time.
[br]
An Entity can do PolyPoint collision. It's a precise and fast way to do collisions. Basically the sprite images will be auto traced to make a polygon outline around them. Then the line segments that make up the polygon will undergo a fast 2D intersection test to see if a collision occurs. Before this however, a very fast spherical check will be performed first to make sure the objects are close, if so the more precise PolyPoint check if performed. The auto trace feature took a lot of time to get working correctly and a guy I met from Russia finally help me get it working properly. I can not remember his name now. If your reading this, respect goes out to you dude. PM me.

Sprites_________________________________________________
The TPGSprite class can manage a list of textures in a local fashion. It will allow you to define your images into pages and groups. A page is the texture file loaded in, a group is the images on this texture. It is more efficient to have multiple images on one textures than to have one image per texture. So TPGSprite will allow you to add images to a group based on a grid layout or if you need to tightly pack your images into the available space you can specify a rectangle. So all the images added to a group becomes an animation if you wish. When you create an entity, you pass in a sprite object and the group the images belong to.

[code=delphi]// init sprite
FSprite := TPGSprite.Create;

// define boss sprite
page := FSprite.LoadPageFromArchive(gTestbed.Archive, 'media/sprites/boss.png',
PG_ColorKey);
group := FSprite.AddGroup;
FSprite.AddImageFromGrid(page, group, 0, 0, 128, 12;
FSprite.AddImageFromGrid(page, group, 1, 0, 128, 12;
FSprite.AddImageFromGrid(page, group, 0, 1, 128, 12;

// init boss entity and add to scene
entity := TBoss.Create;
entity.Init(FSprite, group);
Scene[1].Add(entity);

// define figure sprite
page := FSprite.LoadPageFromArchive(gTestbed.Archive, 'media/sprites/figure.png',
PG_ColorKey);
group := FSprite.AddGroup;
FSprite.AddImageFromGrid(page, group, 0, 0, 128, 12;

// init boss entity and add to scene
entity := TFigure.Create;
entity.Init(FSprite, group);
Scene[0].Add(entity);
[/code]