feat: Basic NPC wandering
This commit is contained in:
27
code/first.c
27
code/first.c
@@ -4,11 +4,15 @@
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/types.h"
|
||||
#include "game/npc.h"
|
||||
#include "os/core.h"
|
||||
|
||||
#include "vulkan/core.h"
|
||||
|
||||
#include "game/impl/player.c"
|
||||
#include "game/world.h"
|
||||
#include "game/impl/npc.c"
|
||||
#include "game/testnavmesh.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -34,6 +38,28 @@ int main(int argc, char **argv)
|
||||
Player player;
|
||||
player.pos.x = 0;
|
||||
player.pos.y = 0;
|
||||
World world = {
|
||||
.npcCount = 2,
|
||||
.npcs = {
|
||||
{
|
||||
.collision = {{10, 10}, {10, 10}},
|
||||
.name = S("Matt"),
|
||||
.mode = NPC_ACTION_WAITING,
|
||||
.waitTime = 0,
|
||||
.maxWaitTime = 5,
|
||||
.currentNavNode = 87
|
||||
},{
|
||||
.collision = {{15, 15}, {10, 10}},
|
||||
.name = S("James"),
|
||||
.mode = NPC_ACTION_WAITING,
|
||||
.waitTime = 0,
|
||||
.maxWaitTime = 10,
|
||||
.currentNavNode = 0
|
||||
}
|
||||
},
|
||||
.navMesh = TestNavMesh,
|
||||
.npcPOI = {100}
|
||||
};
|
||||
while (running)
|
||||
{
|
||||
SDL_Event e;
|
||||
@@ -45,6 +71,7 @@ int main(int argc, char **argv)
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
UpdateNPCs(1.0/60.0, &world);
|
||||
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
|
||||
Reference in New Issue
Block a user