feat: different rooms added
feat: shooting bandit added
This commit is contained in:
@@ -15,10 +15,14 @@ void UpdateNPCs(F32 delta, World *world)
|
||||
{
|
||||
for (U32 i = 0; i < world->npcCount; i++)
|
||||
{
|
||||
UpdateNPC(delta, &world->npcs[i], world);
|
||||
if(world->player.controls.shot && AABB_Point(world->npcs[i].collision, world->player.shotPos)) {
|
||||
// TODO we need to unproject the mouse location !!!
|
||||
printf("You shot %.*s\n", Sv(world->npcs[i].name));
|
||||
NPC *npc = &world->npcs[i];
|
||||
UpdateNPC(delta, npc, world);
|
||||
if(
|
||||
world->player.controls.shot
|
||||
&& AABB_Point(npc->collision, world->player.shotPos)
|
||||
&& npc->currentArea == world->player.currentArea
|
||||
) {
|
||||
printf("You shot %*.s\n", Sv(world->npcs[i].name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,11 +35,17 @@ void ProcessEvents(SDL_Event *event, World *world)
|
||||
void RenderWorld(World *world, D_Context *draw) {
|
||||
for(U32 i = 0; i < world->npcCount; i++) {
|
||||
NPC npc = world->npcs[i];
|
||||
V2f drawPos = AABB_Centre(npc.collision);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 1);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 0, .dim = npc.collision.size, .flags = D_RECT_IGNORE_ASPECT);
|
||||
if(npc.currentArea == world->player.currentArea) {
|
||||
V2f drawPos = AABB_Centre(npc.collision);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 1);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 0, .dim = npc.collision.size, .flags = D_RECT_IGNORE_ASPECT);
|
||||
}
|
||||
}
|
||||
if(world->bandit.currentArea == world->player.currentArea) {
|
||||
V2f drawPos = AABB_Centre(world->bandit.collision);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 9);
|
||||
D_Rect(draw, drawPos.x, drawPos.y, .texture = 0, .dim = world->bandit.collision.size, .flags = D_RECT_IGNORE_ASPECT);
|
||||
}
|
||||
D_Rect(draw, world->bandit.collision.pos.x, world->bandit.collision.pos.y, .texture = 9);
|
||||
D_Rect(draw, world->player.pos.x, world->player.pos.y, .texture = 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user