GamePawn_Initialize
void GamePawn_Initialize(
Game_Pawn* pawn,
const Game_Sprite* sprtList,
u8 sprtNum,
u8 sprtID,
const Game_Action* actList
)

Initialize a game pawn.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to initialize. This is he structure to be used for all other functions.

sprtList
const Game_Sprite*

Array of all sprite layers used to display the pawn. See <Game_Sprite> for details.

sprtNum
u8

Size of the 'sprtList' table (in entries number).

sprtID
u8

First srite index to use for the pawn. The pawn will use all sprite indexes from 'sprtID' to 'sprtID + sprtNum - 1'.  If <GAMEPAWN_ID_PER_LAYER> compile option is activated, this parmeter is not used as each sprit layer define it's own sprite index.

actList
const Game_Action*

Array of pawn action. Needed to use GamePawn_SetAction function.

GamePawn_SetPosition
void GamePawn_SetPosition(
Game_Pawn* pawn,
u8 x,
u8 y
)

Set game pawn position. Force movement even if collision is activated.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to move.

x
u8

New X coordinate (in pixels).

y
u8

New Y coordinate (in pixels).

GamePawn_SetAction
void GamePawn_SetAction(
Game_Pawn* pawn,
u8 id
)

Set game pawn current action index.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to setup.

id
u8

New action index.

GamePawn_SetTileMap
inline void GamePawn_SetTileMap(
const u8* map
)

Set the tile map to be used for collision.  Available only when GAMEPAWN_TILEMAP_SRC is set to GAMEPAWN_TILEMAP_SRC_RAM.

Parameters
map
const u8*

Pointer to RAM buffer with the tile map. Size must be GAMEPAWN_TILEMAP_WIDTH * GAMEPAWN_TILEMAP_HEIGHT.

GamePawn_Update
void GamePawn_Update(
Game_Pawn* pawn
)

Update animation of the game pawn. Must be called once a frame.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to update (move, collision, etc.).

GamePawn_Draw
void GamePawn_Draw(
Game_Pawn* pawn
)

Update rendering of the game pawn. Must be called once a frame.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to draw.

Physics
GamePawn_SetMovement
void GamePawn_SetMovement(
Game_Pawn* pawn,
i8 dx,
i8 dy
)

Set pawn relative movement. Collision can prevent part of the movement.  Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to move.

x

New X movement (in pixels).

y

New Y movement (in pixels).

GamePawn_SetTargetPosition
inline void GamePawn_SetTargetPosition(
Game_Pawn* pawn,
u8 x,
u8 y
)

Set pawn absolute movement. Collision can prevent part of the movement.  Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to move.

x
u8

New X coordinate (in pixels).

y
u8

New Y coordinate (in pixels).

GamePawn_SetPhysicsCallback

Set pawn physics callback Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn

Address of game pawn structure to initialize.

pcb

Callback function to be called when physics events occurs.

ccb

Callback function to be called when collision events occurs.

boundX

Bounding box X extend (in pixels, from the pawn's origin).

boundY

Bounding box Y extend (in pixels, from the pawn's origin).

GamePawn_GetPhysicsState
inline u8 GamePawn_GetPhysicsState(
Game_Pawn* pawn
)

Get pawn physics state.  Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Game_Pawn*

Pointer to pawn structure.

Return

Pawn's physics state.

GamePawn_GetCallbackCellX
inline const u8 GamePawn_GetCallbackCellX()

Get the X coordinate of the cell that triggered a callback.  The value is only valid within a callback.  Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Return

X coordinate of the current cell.

GamePawn_GetCallbackCellY
inline const u8 GamePawn_GetCallbackCellY()

Get the Y coordinate of the cell that triggered a callback.  The value is only valid within a callback.  Only available if GAMEPAWN_USE_PHYSICS compile option is set to TRUE.

Return

Y coordinate of the current cell.