From d85fbe95fae01bec559b7690959cf4db448347f5 Mon Sep 17 00:00:00 2001 From: doyle Date: Wed, 27 Sep 2023 14:47:27 +1000 Subject: [PATCH] fp: Integrate clinger as a spawnable mob --- Data/Textures/clinger_resized_25%.png | 3 + Data/Textures/clinger_resized_25%.txt | 3 + .../clinger_attack_down_1.png | 3 + .../clinger_attack_down_2.png | 3 + .../clinger_attack_down_3.png | 3 + .../clinger_attack_side_1.png | 3 + .../clinger_attack_side_2.png | 3 + .../clinger_attack_side_3.png | 3 + .../clinger_attack_up_1.png | 3 + .../clinger_attack_up_2.png | 3 + .../clinger_attack_up_3.png | 3 + .../clinger_resized_25%/clinger_death_1.png | 3 + .../clinger_resized_25%/clinger_death_2.png | 3 + .../clinger_resized_25%/clinger_death_3.png | 3 + .../clinger_resized_25%/clinger_death_4.png | 3 + .../clinger_resized_25%/clinger_death_5.png | 3 + .../clinger_walk_down_1.png | 3 + .../clinger_walk_down_2.png | 3 + .../clinger_resized_25%/clinger_walk_up_1.png | 3 + .../clinger_resized_25%/clinger_walk_up_2.png | 3 + Data/Textures/sprite_spec.txt | 4 +- build_assets.bat | 1 + feely_pona.cpp | 132 +++++++++++++++++- feely_pona_entity.cpp | 19 +++ feely_pona_entity.h | 10 ++ feely_pona_game.h | 1 + 26 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 Data/Textures/clinger_resized_25%.png create mode 100644 Data/Textures/clinger_resized_25%.txt create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_down_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_down_2.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_down_3.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_side_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_side_2.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_side_3.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_up_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_up_2.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_attack_up_3.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_death_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_death_2.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_death_3.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_death_4.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_death_5.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_walk_down_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_walk_down_2.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_walk_up_1.png create mode 100644 Data/Textures/clinger_resized_25%/clinger_walk_up_2.png diff --git a/Data/Textures/clinger_resized_25%.png b/Data/Textures/clinger_resized_25%.png new file mode 100644 index 0000000..c8cb999 --- /dev/null +++ b/Data/Textures/clinger_resized_25%.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb992c028ca4200a91c75c018a71a373fe92c7cf72602713b1c74be91d6c3e2c +size 1483437 diff --git a/Data/Textures/clinger_resized_25%.txt b/Data/Textures/clinger_resized_25%.txt new file mode 100644 index 0000000..13da327 --- /dev/null +++ b/Data/Textures/clinger_resized_25%.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49ef4e902ca668341df9b52b7ddd210780aafbeff30aa4f6e3d9ee8f7b3b30ae +size 478 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_down_1.png b/Data/Textures/clinger_resized_25%/clinger_attack_down_1.png new file mode 100644 index 0000000..cf1d78d --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_down_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8aef0b6136290a1970ba9a6be68e23eede4e4e9de043fb319f39526e2f0b46c5 +size 64185 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_down_2.png b/Data/Textures/clinger_resized_25%/clinger_attack_down_2.png new file mode 100644 index 0000000..9be85e0 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_down_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7fb587f48024bb0e5eeee53379e4037ee93616d0df09ad58a056dd76d29d0dfb +size 63696 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_down_3.png b/Data/Textures/clinger_resized_25%/clinger_attack_down_3.png new file mode 100644 index 0000000..c00e740 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_down_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5496b7450bfa540374485c30ad866dd09efd52f3868c155fb322e10fe337f55b +size 63979 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_side_1.png b/Data/Textures/clinger_resized_25%/clinger_attack_side_1.png new file mode 100644 index 0000000..c5fc60a --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_side_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:920860bfb66ce8032cebe4c0ca725d371107ae73ca67cd6acdd3962342b75733 +size 80027 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_side_2.png b/Data/Textures/clinger_resized_25%/clinger_attack_side_2.png new file mode 100644 index 0000000..42965af --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_side_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:966a60837f56085bbb30b2a3cb8987a01c57a1aca6d3ca6eadb272b2af6b49bd +size 73740 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_side_3.png b/Data/Textures/clinger_resized_25%/clinger_attack_side_3.png new file mode 100644 index 0000000..e685d14 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_side_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89fda6892e7987fa725a384d4215c14da32c946e5e54f7f59ebc2c93e9404af2 +size 74823 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_up_1.png b/Data/Textures/clinger_resized_25%/clinger_attack_up_1.png new file mode 100644 index 0000000..f44b554 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_up_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7395f601c1b426eef098b4363fe90f79f497d52a838e5809646343cf91f9c284 +size 46610 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_up_2.png b/Data/Textures/clinger_resized_25%/clinger_attack_up_2.png new file mode 100644 index 0000000..8b1eced --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_up_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b2e6bae22db0ac7f742f48d3aea092a5000423fbcaf41fef5617ed7c0127038 +size 45224 diff --git a/Data/Textures/clinger_resized_25%/clinger_attack_up_3.png b/Data/Textures/clinger_resized_25%/clinger_attack_up_3.png new file mode 100644 index 0000000..e0ba7ef --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_attack_up_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bd08b01f97ed76956064c01ad58d15ed039487a19a520f2720ff3e748d842bf +size 45046 diff --git a/Data/Textures/clinger_resized_25%/clinger_death_1.png b/Data/Textures/clinger_resized_25%/clinger_death_1.png new file mode 100644 index 0000000..28304ba --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_death_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb8d25c09b3732edd88b57258b4c0388258138b649c2f0bff635069e2cefc8f5 +size 70127 diff --git a/Data/Textures/clinger_resized_25%/clinger_death_2.png b/Data/Textures/clinger_resized_25%/clinger_death_2.png new file mode 100644 index 0000000..71cd6ce --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_death_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59f93071b21ac73e84a5f9475c35fde207a42bfcdb9f5a728bbed4b31494ee33 +size 36137 diff --git a/Data/Textures/clinger_resized_25%/clinger_death_3.png b/Data/Textures/clinger_resized_25%/clinger_death_3.png new file mode 100644 index 0000000..4b12bb8 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_death_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcdb0eae996f5051bb99a808662798c8c725eec00c5ec4affbde791ad08b6a51 +size 39867 diff --git a/Data/Textures/clinger_resized_25%/clinger_death_4.png b/Data/Textures/clinger_resized_25%/clinger_death_4.png new file mode 100644 index 0000000..f4a177e --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_death_4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22673354a9b205434c81d88dda969ae1e66c5c5ae2907c0f6fa1bddeeba7e48a +size 28731 diff --git a/Data/Textures/clinger_resized_25%/clinger_death_5.png b/Data/Textures/clinger_resized_25%/clinger_death_5.png new file mode 100644 index 0000000..009d7e7 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_death_5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:573fd47372965e0f6bcd78e7af2126e025eb597fd61febe2bea4ea11bcebd329 +size 6622 diff --git a/Data/Textures/clinger_resized_25%/clinger_walk_down_1.png b/Data/Textures/clinger_resized_25%/clinger_walk_down_1.png new file mode 100644 index 0000000..8d79f7b --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_walk_down_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6826e3ac85e599f45eba88cc519b23e1ae96455e18885c8e19ca46d300eb4b2 +size 57846 diff --git a/Data/Textures/clinger_resized_25%/clinger_walk_down_2.png b/Data/Textures/clinger_resized_25%/clinger_walk_down_2.png new file mode 100644 index 0000000..086ace7 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_walk_down_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32e20a0e685f60f94d5c39fd0fc1698a71900cac241bfa41bd0a778ba3be2c07 +size 57730 diff --git a/Data/Textures/clinger_resized_25%/clinger_walk_up_1.png b/Data/Textures/clinger_resized_25%/clinger_walk_up_1.png new file mode 100644 index 0000000..cee5241 --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_walk_up_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4a1946d9e6df5135a733bed44c0e4f681d9217cb6fe7f24441fa70da4643ccc +size 42415 diff --git a/Data/Textures/clinger_resized_25%/clinger_walk_up_2.png b/Data/Textures/clinger_resized_25%/clinger_walk_up_2.png new file mode 100644 index 0000000..ca9350c --- /dev/null +++ b/Data/Textures/clinger_resized_25%/clinger_walk_up_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e7e5b45f44ebc05719b4c5c047b3b69269e172bfe8fe0b892583aaf080498c0 +size 40584 diff --git a/Data/Textures/sprite_spec.txt b/Data/Textures/sprite_spec.txt index 4426fd0..feaa75d 100644 --- a/Data/Textures/sprite_spec.txt +++ b/Data/Textures/sprite_spec.txt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:303c69a1100db4d100f81eabb313f92930e807f1dd9c53fca52294859c0f2305 -size 353 +oid sha256:d532f2c8c4e3de8f8911e667537b5b063ae8564084e70984507f25f1a370f102 +size 479 diff --git a/build_assets.bat b/build_assets.bat index 868390b..8b07e1f 100644 --- a/build_assets.bat +++ b/build_assets.bat @@ -13,3 +13,4 @@ if not exist "%sprite_packer%" ( %sprite_packer% 4096x4096 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\terry_resized_25%% || exit /b 1 %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\terry_merchant_resized_25%% || exit /b 1 %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\smoochie_resized_25%% || exit /b 1 +%sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\clinger_resized_25%% || exit /b 1 diff --git a/feely_pona.cpp b/feely_pona.cpp index c898571..8642b3a 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -15,6 +15,7 @@ struct FP_GlobalAnimations Dqn_String8 terry_attack_side = DQN_STRING8("terry_attack_side"); Dqn_String8 terry_attack_down = DQN_STRING8("terry_attack_down"); Dqn_String8 terry_merchant = DQN_STRING8("terry_merchant"); + Dqn_String8 smoochie_walk_up = DQN_STRING8("smoochie_walk_up"); Dqn_String8 smoochie_walk_down = DQN_STRING8("smoochie_walk_down"); Dqn_String8 smoochie_walk_left = DQN_STRING8("smoochie_walk_left"); @@ -23,6 +24,13 @@ struct FP_GlobalAnimations Dqn_String8 smoochie_hurt_side = DQN_STRING8("smoochie_hurt_side"); Dqn_String8 smoochie_attack_heart = DQN_STRING8("smoochie_attack_heart"); Dqn_String8 smoochie_death = DQN_STRING8("smoochie_death"); + + Dqn_String8 clinger_attack_down = DQN_STRING8("clinger_attack_down"); + Dqn_String8 clinger_attack_side = DQN_STRING8("clinger_attack_side"); + Dqn_String8 clinger_attack_up = DQN_STRING8("clinger_attack_up"); + Dqn_String8 clinger_death = DQN_STRING8("clinger_death"); + Dqn_String8 clinger_walk_up = DQN_STRING8("clinger_walk_up"); + Dqn_String8 clinger_walk_down = DQN_STRING8("clinger_walk_down"); } g_anim_names; @@ -176,6 +184,7 @@ void TELY_DLL_Init(void *user_data) game->terry_sprite_sheet = FP_LoadSpriteSheetFromSpec(platform, assets, &platform->arena, DQN_STRING8("terry_resized_25%")); game->terry_merchant_sprite_sheet = FP_LoadSpriteSheetFromSpec(platform, assets, &platform->arena, DQN_STRING8("terry_merchant_resized_25%")); game->smoochie_sprite_sheet = FP_LoadSpriteSheetFromSpec(platform, assets, &platform->arena, DQN_STRING8("smoochie_resized_25%")); + game->clinger_sprite_sheet = FP_LoadSpriteSheetFromSpec(platform, assets, &platform->arena, DQN_STRING8("clinger_resized_25%")); } game->entities = Dqn_VArray_Init(&platform->arena, 1024 * 8); @@ -589,6 +598,116 @@ void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_Ga } } break; + case FP_EntityType_Clinger: { + FP_EntityClingerState *state = DQN_CAST(FP_EntityClingerState *)&action->state; + TELY_AssetSpriteSheet *sheet = &game->clinger_sprite_sheet; + + switch (*state) { + case FP_EntityClingerState_Nil: { + action->next_state = FP_EntityClingerState_Idle; + } break; + + case FP_EntityClingerState_Idle: { + if (entering_new_state) { + TELY_AssetAnimatedSprite sprite = TELY_Asset_MakeAnimatedSprite(sheet, g_anim_names.clinger_walk_down, TELY_AssetFlip_No); + uint64_t duration_ms = FP_GAME_ENTITY_ACTION_INFINITE_TIMER; + FP_Game_EntityActionReset(game, entity->handle, duration_ms, sprite); + } + + if (we_are_clicked_entity) { + if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J) || + TELY_Platform_InputGamepadButtonCodeIsPressed(input, 0, TELY_PlatformInputGamepadButtonCode_X)) { + action->next_state = FP_EntityClingerState_Attack; + } else if (dir_vector.x || dir_vector.y) { + action->next_state = FP_EntityClingerState_Run; + } + } + + if (entity_has_velocity) { + action->next_state = FP_EntityClingerState_Run; + } + } break; + + case FP_EntityClingerState_Attack: { + uint32_t asset_flip = {}; + Dqn_String8 desired_action_name = {}; + switch (entity->direction) { + case FP_GameDirection_Up: desired_action_name = g_anim_names.clinger_attack_up; break; + case FP_GameDirection_Down: desired_action_name = g_anim_names.clinger_attack_down; break; + case FP_GameDirection_Left: desired_action_name = g_anim_names.clinger_attack_side; asset_flip |= TELY_AssetFlip_X; break; + case FP_GameDirection_Right: desired_action_name = g_anim_names.clinger_attack_side; break; + } + + if (entering_new_state) { + TELY_AssetAnimatedSprite sprite = TELY_Asset_MakeAnimatedSprite(sheet, desired_action_name, DQN_CAST(TELY_AssetFlip)asset_flip); + uint64_t duration_ms = sprite.anim->count * sprite.anim->ms_per_frame; + FP_Game_EntityActionReset(game, entity->handle, duration_ms, sprite); + } + + if (action_has_finished) + action->next_state = FP_EntityClingerState_Idle; + } break; + + case FP_EntityClingerState_Death: { + // TODO(doyle): Implement + } break; + + case FP_EntityClingerState_Run: { + Dqn_String8 desired_action_name = {}; + switch (entity->direction) { + case FP_GameDirection_Up: desired_action_name = g_anim_names.clinger_walk_up; break; + case FP_GameDirection_Down: desired_action_name = g_anim_names.clinger_walk_down; break; + case FP_GameDirection_Left: desired_action_name = g_anim_names.clinger_walk_down; break; + case FP_GameDirection_Right: desired_action_name = g_anim_names.clinger_walk_down; break; + } + + if (entering_new_state || action->sprite.anim->label != desired_action_name) { + TELY_AssetAnimatedSprite sprite = TELY_Asset_MakeAnimatedSprite(sheet, desired_action_name, TELY_AssetFlip_No); + uint64_t duration_ms = FP_GAME_ENTITY_ACTION_INFINITE_TIMER; + FP_Game_EntityActionReset(game, entity->handle, duration_ms, sprite); + } + + if (we_are_clicked_entity) { + if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J) || + TELY_Platform_InputGamepadButtonCodeIsPressed(input, 0, TELY_PlatformInputGamepadButtonCode_X)) { + action->next_state = FP_EntityClingerState_Attack; + } + } + + if (!entity_has_velocity) { + action->next_state = FP_EntityClingerState_Idle; + } + } break; + } + + if (*state == FP_EntityClingerState_Attack) { // NOTE: Position the attack box + entity->attack_box_size = entity->local_hit_box_size; + switch (entity->direction) { + case FP_GameDirection_Left: { + entity->attack_box_offset = Dqn_V2_InitNx2(entity->local_hit_box_offset.x - entity->attack_box_size.w, + entity->local_hit_box_offset.y); + } break; + + case FP_GameDirection_Right: { + entity->attack_box_offset = Dqn_V2_InitNx2(entity->local_hit_box_offset.x + entity->attack_box_size.w, + entity->local_hit_box_offset.y); + } break; + + case FP_GameDirection_Up: { + entity->attack_box_offset = Dqn_V2_InitNx2(entity->local_hit_box_offset.x, + entity->local_hit_box_offset.y - entity->attack_box_size.h); + } break; + + case FP_GameDirection_Down: { + entity->attack_box_offset = Dqn_V2_InitNx2(entity->local_hit_box_offset.x, + entity->local_hit_box_offset.y + entity->attack_box_size.h); + } break; + } + } else { + entity->attack_box_size = {}; + } + } break; + case FP_EntityType_Merchant: { FP_EntityTerryMerchantState *state = DQN_CAST(FP_EntityTerryMerchantState *)&action->state; TELY_AssetSpriteSheet *sheet = &game->terry_merchant_sprite_sheet; @@ -776,7 +895,14 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input // from the entity's current state entity->action.next_state = FP_EntitySmoochieState_AttackDown; } break; + + case FP_EntityType_Clinger: { + entity->action.next_state = FP_EntityClingerState_Attack; + } break; } + + // NOTE: Aggro makes the entity attack Terry, we will + // exit here preserving the waypoint in the entity. break; } else { FP_SentinelList_Erase(&entity->waypoints, waypoint_link, game->chunk_pool); @@ -952,7 +1078,11 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input Dqn_V2 entity_world_pos = FP_Game_CalcEntityWorldPos(game, entity->handle); FP_SentinelListLink *link = FP_SentinelList_Make(&entity->spawn_list, game->chunk_pool); - link->data = FP_Entity_CreateSmoochie(game, entity_world_pos, "Smoochie"); + + if (Dqn_PCG32_NextF32(&game->rng) >= 0.5f) + link->data = FP_Entity_CreateClinger(game, entity_world_pos, "Clinger"); + else + link->data = FP_Entity_CreateSmoochie(game, entity_world_pos, "Smoochie"); // NOTE: Setup the mob with waypoints FP_GameEntity *mob = FP_Game_GetEntity(game, link->data); diff --git a/feely_pona_entity.cpp b/feely_pona_entity.cpp index aaa50e7..929a0e8 100644 --- a/feely_pona_entity.cpp +++ b/feely_pona_entity.cpp @@ -35,6 +35,25 @@ static FP_GameEntityHandle FP_Entity_CreateWaypointF(FP_Game *game, Dqn_V2 pos, return result; } +static FP_GameEntityHandle FP_Entity_CreateClinger(FP_Game *game, Dqn_V2 pos, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) +{ + va_list args; + va_start(args, fmt); + FP_GameEntity *entity = FP_Game_MakeEntityPointerFV(game, fmt, args); + FP_GameEntityHandle result = entity->handle; + va_end(args); + + entity->type = FP_EntityType_Clinger; + entity->hp = 3; + entity->local_pos = pos; + entity->sprite_height.meters = 1.6f; + entity->local_hit_box_size = FP_Game_MetersToPixelsNx2(game, 0.4f, 1.7f); + FP_Entity_AddDebugEditorFlags(game, entity->handle); + entity->flags |= FP_GameEntityFlag_NonTraversable; + entity->flags |= FP_GameEntityFlag_Attackable; + return result; +} + static FP_GameEntityHandle FP_Entity_CreateSmoochie(FP_Game *game, Dqn_V2 pos, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) { va_list args; diff --git a/feely_pona_entity.h b/feely_pona_entity.h index e14e11f..fa08f36 100644 --- a/feely_pona_entity.h +++ b/feely_pona_entity.h @@ -9,6 +9,7 @@ enum FP_EntityType FP_EntityType_Terry, FP_EntityType_Smoochie, FP_EntityType_Merchant, + FP_EntityType_Clinger, }; enum FP_EntityTerryState @@ -32,6 +33,15 @@ enum FP_EntitySmoochieState FP_EntitySmoochieState_Run, }; +enum FP_EntityClingerState +{ + FP_EntityClingerState_Nil, + FP_EntityClingerState_Idle, + FP_EntityClingerState_Attack, + FP_EntityClingerState_Death, + FP_EntityClingerState_Run, +}; + enum FP_EntityTerryMerchantState { FP_EntityTerryMerchantState_Nil, diff --git a/feely_pona_game.h b/feely_pona_game.h index fb9c5b4..c606108 100644 --- a/feely_pona_game.h +++ b/feely_pona_game.h @@ -192,6 +192,7 @@ struct FP_Game TELY_AssetSpriteSheet terry_sprite_sheet; TELY_AssetSpriteSheet smoochie_sprite_sheet; TELY_AssetSpriteSheet terry_merchant_sprite_sheet; + TELY_AssetSpriteSheet clinger_sprite_sheet; FP_GameEntity *root_entity; FP_GameEntity *entity_free_list;