void HookEntityRender(int entity, string func)
int e;
// Hook all current map entities to PaperDollRender()
for(e = 0; e < entities; e++)
{
HookEntityRender(e, "PaperDollRender");
}
void PaperDollRender()
// Give everyone cloaks and moustaches
{
// Work out the x,y coord of the current entity's hotspot on the screen
int pdr_xh = entity.x[event.entity] - xwin;
int pdr_yh = entity.y[event.entity] - ywin;
// Work out the x,y coord of the top left corner of an entity's tile
int pdr_xb = pdr_xh - entity.hotx[event.entity];
int pdr_yb = pdr_yh - entity.hoty[event.entity];
// Blit the cloak tile UNDER the entity
TBlit(pdr_xb, pdr_yb, cloak, screen);
// Blit the entity's current frame
BlitEntityFrame(pdr_xh, pdr_yh, event.entity, entity.frame[event.entity], screen);
// Blit the moustache tile OVER the entity
TBlit(pdr_xb, pdr_yb, moustache, screen);
}
// Note: In practice, you'd probably want to want to use TGrabRegion() based on the
// entity.frame[event.entity] value to get a tile that matches with the current frame
// of the entity, but this example is already complicated enough :DThere are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
![]() |
Your docs |
![]() |