Example global ent
This commit is contained in:
+1
-19
@@ -45,25 +45,7 @@ errorret_t rpgInit(void) {
|
||||
if(ci != -1) entitySetChunk(ent, (uint8_t)ci);
|
||||
}
|
||||
|
||||
uint8_t npcIndex = entityGetAvailable();
|
||||
entity_t *npc = &ENTITIES[npcIndex];
|
||||
entityInit(npc, ENTITY_TYPE_NPC);
|
||||
npc->globalId = ENTITY_GLOBAL_ID_START;
|
||||
npcSetMoveType(npc, NPC_MOVE_TYPE_PATH);
|
||||
entityPositionSet(npc, (worldpos_t){ 8, 8, 1 });
|
||||
npc->interact.type = ENTITY_INTERACT_CUTSCENE;
|
||||
npc->interact.data.cutscene = CUTSCENE_REFERENCE(TEST_TWO);
|
||||
{
|
||||
chunkpos_t cp;
|
||||
worldPosToChunkPos(&npc->position, &cp);
|
||||
chunkindex_t ci = mapGetChunkIndexAt(cp);
|
||||
if(ci != -1) entitySetChunk(npc, (uint8_t)ci);
|
||||
}
|
||||
|
||||
npcPathAddNode(&npc->data.npc, (worldpos_t){ 4, 4, 0 });
|
||||
npcPathAddNode(&npc->data.npc, (worldpos_t){ 10, 10, 1 });
|
||||
npcPathAddNode(&npc->data.npc, (worldpos_t){ 4, 4, 0 });
|
||||
npcPathAddNode(&npc->data.npc, (worldpos_t){ 10, 10, 1 });
|
||||
mapSpawnEntity(3, (worldpos_t){ 8, 8, 1 });
|
||||
|
||||
// All Good!
|
||||
errorOk();
|
||||
|
||||
Reference in New Issue
Block a user