fp: Add spawning on all 3 lanes
This commit is contained in:
parent
015ae9d82b
commit
47cf075c3b
@ -309,7 +309,7 @@ void TELY_DLL_Init(void *user_data)
|
|||||||
game->player = terry;
|
game->player = terry;
|
||||||
}
|
}
|
||||||
|
|
||||||
FP_Entity_CreateMerchant(game, Dqn_V2_InitNx2(1000, 124), "Merchant");
|
FP_Entity_CreateMerchant(game, Dqn_V2_InitNx2(1018, -351), "Merchant");
|
||||||
FP_Entity_CreateClubTerry(game, Dqn_V2_InitNx2(1000, 400), "Club Terry");
|
FP_Entity_CreateClubTerry(game, Dqn_V2_InitNx2(1000, 400), "Club Terry");
|
||||||
|
|
||||||
game->tile_size = 37;
|
game->tile_size = 37;
|
||||||
@ -357,16 +357,38 @@ void TELY_DLL_Init(void *user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Mob spawner ===========================================================================
|
// NOTE: Mid lane mob spawner ==================================================================
|
||||||
|
Dqn_V2 base_mid_p = Dqn_V2_InitNx2(1580, 0.f);
|
||||||
|
Dqn_V2 mid_lane_mob_spawner_pos = Dqn_V2_InitNx2(game->map->local_hit_box_size.w * -0.5f, 0.f);
|
||||||
{
|
{
|
||||||
Dqn_V2 mob_spawner_pos = FP_Game_MetersToPixelsNx2(game, 2.f, 5.f);
|
FP_GameEntityHandle mob_spawner = FP_Entity_CreateMobSpawner(game, mid_lane_mob_spawner_pos, 128 /*spawn_cap*/, "Mob spawner");
|
||||||
FP_GameEntityHandle mob_spawner = FP_Entity_CreateMobSpawner(game, mob_spawner_pos, 128 /*spawn_cap*/, "Mob spawner");
|
|
||||||
FP_Game_PushParentEntity(game, mob_spawner);
|
FP_Game_PushParentEntity(game, mob_spawner);
|
||||||
FP_Entity_CreateWaypointF(game, FP_Game_MetersToPixelsNx2(game, 2.f, 4.f), "Waypoint A");
|
FP_Entity_CreateWaypointF(game, Dqn_V2_InitNx2(-mid_lane_mob_spawner_pos.x + base_mid_p.x, base_mid_p.y), "Waypoint");
|
||||||
FP_Entity_CreateWaypointF(game, FP_Game_MetersToPixelsNx2(game, 14.f, 8.f), "Waypoint B");
|
FP_Game_PopParentEntity(game);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: Bottom lane spawner ===================================================================
|
||||||
|
Dqn_V2 bottom_lane_mob_spawner_pos = Dqn_V2_InitNx2(mid_lane_mob_spawner_pos.x, mid_lane_mob_spawner_pos.y + 932.f);
|
||||||
|
{
|
||||||
|
FP_GameEntityHandle mob_spawner = FP_Entity_CreateMobSpawner(game, bottom_lane_mob_spawner_pos, 128 /*spawn_cap*/, "Mob spawner");
|
||||||
|
FP_Game_PushParentEntity(game, mob_spawner);
|
||||||
|
FP_Entity_CreateWaypointF(game, Dqn_V2_InitNx2(-bottom_lane_mob_spawner_pos.x + base_mid_p.x, 0.f), "Waypoint");
|
||||||
|
FP_Entity_CreateWaypointF(game, Dqn_V2_InitNx2(-bottom_lane_mob_spawner_pos.x + base_mid_p.x, -932.f), "Waypoint");
|
||||||
FP_Game_PopParentEntity(game);
|
FP_Game_PopParentEntity(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Top lane spawner ===================================================================
|
||||||
|
Dqn_V2 top_lane_mob_spawner_pos = Dqn_V2_InitNx2(mid_lane_mob_spawner_pos.x, mid_lane_mob_spawner_pos.y - 915.f);
|
||||||
|
{
|
||||||
|
FP_GameEntityHandle mob_spawner = FP_Entity_CreateMobSpawner(game, top_lane_mob_spawner_pos, 128 /*spawn_cap*/, "Mob spawner");
|
||||||
|
FP_Game_PushParentEntity(game, mob_spawner);
|
||||||
|
FP_Entity_CreateWaypointF(game, Dqn_V2_InitNx2(-top_lane_mob_spawner_pos.x + base_mid_p.x, 0.f), "Waypoint");
|
||||||
|
FP_Entity_CreateWaypointF(game, Dqn_V2_InitNx2(-top_lane_mob_spawner_pos.x + base_mid_p.x, +915.f), "Waypoint");
|
||||||
|
FP_Game_PopParentEntity(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t font_size = 18;
|
uint16_t font_size = 18;
|
||||||
game->camera.scale = Dqn_V2_InitNx1(1);
|
game->camera.scale = Dqn_V2_InitNx1(1);
|
||||||
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Inter-Regular.otf"), font_size);
|
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Inter-Regular.otf"), font_size);
|
||||||
@ -968,7 +990,11 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
|
|||||||
if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_Delete))
|
if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_Delete))
|
||||||
FP_Game_DeleteEntity(game, game->clicked_entity);
|
FP_Game_DeleteEntity(game, game->clicked_entity);
|
||||||
} else {
|
} else {
|
||||||
game->camera.world_pos += dir_vector * 5.f;
|
Dqn_f32 pan_speed = 5.f;
|
||||||
|
if (TELY_Platform_InputScanCodeIsDown(input, TELY_PlatformInputScanCode_Space))
|
||||||
|
pan_speed *= 2.5f;
|
||||||
|
|
||||||
|
game->camera.world_pos += dir_vector * pan_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dqn_ProfilerZone update_zone = Dqn_Profiler_BeginZoneWithIndex(DQN_STRING8("FP_Update: Entity loop"), FP_ProfileZone_FPUpdate_EntityLoop);
|
Dqn_ProfilerZone update_zone = Dqn_Profiler_BeginZoneWithIndex(DQN_STRING8("FP_Update: Entity loop"), FP_ProfileZone_FPUpdate_EntityLoop);
|
||||||
@ -1377,15 +1403,15 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if (!FP_Game_IsNilEntityHandle(game, game->clicked_entity)) {
|
||||||
TELY_AssetSpriteAnimation *sprite_anim = TELY_Asset_GetSpriteAnimation(&game->map_sprite_sheet, g_anim_names.map);
|
TELY_AssetSpriteAnimation *sprite_anim = TELY_Asset_GetSpriteAnimation(&game->map_sprite_sheet, g_anim_names.map);
|
||||||
Dqn_Rect sprite_rect = game->map_sprite_sheet.rects.data[sprite_anim->index];
|
Dqn_Rect sprite_rect = game->map_sprite_sheet.rects.data[sprite_anim->index];
|
||||||
|
|
||||||
const Dqn_usize target_width = 1800;
|
const Dqn_usize target_width = 1800;
|
||||||
const Dqn_usize target_height = 1046;
|
const Dqn_usize target_height = 1046;
|
||||||
|
|
||||||
game->camera.world_pos.x = DQN_MIN(game->camera.world_pos.x, game->map->local_hit_box_size.w * +0.5f - target_width);
|
game->camera.world_pos.x = DQN_MIN(game->camera.world_pos.x, game->map->local_hit_box_size.w * +0.5f - target_width);
|
||||||
game->camera.world_pos.x = DQN_MAX(game->camera.world_pos.x, game->map->local_hit_box_size.w * -0.5f);
|
game->camera.world_pos.x = DQN_MAX(game->camera.world_pos.x, game->map->local_hit_box_size.w * -0.5f);
|
||||||
|
|
||||||
game->camera.world_pos.y = DQN_MAX(game->camera.world_pos.y, game->map->local_hit_box_size.h * -0.5f);
|
game->camera.world_pos.y = DQN_MAX(game->camera.world_pos.y, game->map->local_hit_box_size.h * -0.5f);
|
||||||
game->camera.world_pos.y = DQN_MIN(game->camera.world_pos.y, game->map->local_hit_box_size.h * +0.5f - target_height);
|
game->camera.world_pos.y = DQN_MIN(game->camera.world_pos.y, game->map->local_hit_box_size.h * +0.5f - target_height);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user