From 9b3bbf4ef7c26c1267e8ea99024d9d1acd7f1376 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 27 Jul 2025 04:46:59 -0600 Subject: Flower --- assets/flower.png | Bin 0 -> 2561 bytes src/assets.c | 3 ++- src/assets.h | 5 +++-- src/entity.c | 7 +++++++ src/entity.h | 6 ++++-- src/world.c | 4 ++-- 6 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 assets/flower.png diff --git a/assets/flower.png b/assets/flower.png new file mode 100644 index 0000000..09685a6 Binary files /dev/null and b/assets/flower.png differ diff --git a/src/assets.c b/src/assets.c index 1a7113a..0434b5c 100644 --- a/src/assets.c +++ b/src/assets.c @@ -4,7 +4,8 @@ const char textureAssetPaths[TEXTURE_ASSET_COUNT][FT_NAMEMAX] = { "mint.png", "nickel.png", "tree.png", - "bush.png" + "bush.png", + "flower.png" }; void initAssets(Assets* assets) diff --git a/src/assets.h b/src/assets.h index f5ef97f..2a1ee66 100644 --- a/src/assets.h +++ b/src/assets.h @@ -3,7 +3,7 @@ #ifndef ASSETS_H #define ASSETS_H -#define TEXTURE_ASSET_COUNT 4 +#define TEXTURE_ASSET_COUNT 5 extern const char textureAssetPaths[TEXTURE_ASSET_COUNT][FT_NAMEMAX]; @@ -14,7 +14,8 @@ enum { MINT_TEXTURE, NICKEL_TEXTURE, TREE_TEXTURE, - BUSH_TEXTURE + BUSH_TEXTURE, + FLOWER_TEXTURE }; typedef struct { diff --git a/src/entity.c b/src/entity.c index de5f7f3..2ad7754 100644 --- a/src/entity.c +++ b/src/entity.c @@ -30,6 +30,9 @@ Entity createEntity(EntityId id, Vector3 position) case BUSH: entity.box = entityBoxFromScale(BUSH_SCALE, 174.0, 124.0); break; + case FLOWER: + entity.box = entityBoxFromScale(FLOWER_SCALE, 32.0, 54.0); + break; default: break; } @@ -59,6 +62,10 @@ void updateEntity(Entity* entity, Game* game) DrawBillboard(game->player.camera, game->assets.textures[BUSH_TEXTURE], entity->position, BUSH_SCALE, WHITE); break; + case FLOWER: + DrawBillboard(game->player.camera, game->assets.textures[FLOWER_TEXTURE], + entity->position, FLOWER_SCALE, WHITE); + break; default: break; } diff --git a/src/entity.h b/src/entity.h index 915c562..f647e14 100644 --- a/src/entity.h +++ b/src/entity.h @@ -7,18 +7,20 @@ typedef int8_t EntityId; -#define ENTITY_COUNT 4 +#define ENTITY_COUNT 5 // Entity scales. #define TREE_SCALE 32.0 #define BUSH_SCALE 6.0 +#define FLOWER_SCALE 2.0 enum { ENTITY_NONE = -1, OLD_MINT, STICKY_NICKEL, TREE, - BUSH + BUSH, + FLOWER }; typedef struct { diff --git a/src/world.c b/src/world.c index a576e24..6b8d60b 100644 --- a/src/world.c +++ b/src/world.c @@ -335,8 +335,8 @@ Seed generateWorldPlants(World* world, Seed seed) FT_RANDOM16(seed); // Get id for plant. - EntityId plants[] = {TREE, BUSH}; - size_t plantsSize = 2; + EntityId plants[] = {TREE, BUSH, FLOWER}; + size_t plantsSize = 3; EntityId id = plants[seed % plantsSize]; // Get position. -- cgit v1.2.3