Przeglądaj źródła

update readme/changelog + check npc draw

jblanked 11 miesięcy temu
rodzic
commit
4e94e1f1b0
4 zmienionych plików z 28 dodań i 14 usunięć
  1. 10 8
      README.md
  2. 2 1
      assets/CHANGELOG.md
  3. 9 5
      assets/README.md
  4. 7 0
      game/npc.c

+ 10 - 8
README.md

@@ -1,10 +1,8 @@
 # FlipWorld
-
 The first open-world multiplayer game for the Flipper Zero, best played with the VGM. Here's a video tutorial: https://www.youtube.com/watch?v=Qp7qmYMfdUA
 
 ## Requirements
-
-- WiFi Developer Board, Raspberry Pi, or ESP32 device with the FlipperHTTP flash: [FlipperHTTP GitHub](https://github.com/jblanked/FlipperHTTP)
+- WiFi Developer Board, Raspberry Pi, or ESP32 device with the [FlipperHTTP flash](https://github.com/jblanked/FlipperHTTP).
 - 2.4 GHz WiFi access point
 
 ## How It Works
@@ -23,7 +21,7 @@ FlipWorld and FlipSocial are connected. Your login information is the same in bo
 - **Press/Hold RIGHT**: Turn right if not already facing right, then walk right if the button is still pressed.
 - **Press/Hold UP**: Walk up.
 - **Press/Hold DOWN**: Walk down.
-- **Press OK**: Attack/Teleport (set to attack until all enemies are defeated).
+- **Press OK**: Interact/Attack/Teleport (set to attack until all enemies are defeated and interact when colliding with NPCs)
 - **HOLD OK**: In-Game Menu.
 - **Press BACK**: Leave the menu.
 - **HOLD BACK**: Exit the game.
@@ -49,6 +47,9 @@ If an enemy attacks you, your health decreases by the enemy's strength (attack p
 
 An enemy attack registers if the enemy is facing you and collides with you. However, to attack an enemy successfully, the enemy must be facing away from you, and you must collide with them while pressing `OK`.
 
+**NPCs**
+
+NPCs are friendly characters that players can interact with. Currently, you can interact with them by clicking `OK` while colliding with them.
 
 ## Short Tutorial
 
@@ -70,15 +71,16 @@ An enemy attack registers if the enemy is facing you and collides with you. Howe
 
 **v0.4**
 - New game features
-- World expansion
 - Stability patch
+- World expansion
 
 **v0.5**
-- New game features
-- Custom Controller Support
+- Stability patch
+- NPCs
 
 **v0.6**
-- ???
+- New game features
+- Custom Controller Support
 
 **v0.7**
 - ???

+ 2 - 1
assets/CHANGELOG.md

@@ -1,6 +1,7 @@
-## 0.5 (2025-01-27)
+## 0.5 (2025-01-31)
 - Fixed saving errors.
 - Improved memory allocation.
+- Added NPCs.
 
 ## 0.4 (2025-01-23)
 - Added an In-Game menu.

+ 9 - 5
assets/README.md

@@ -1,7 +1,6 @@
 The first open-world multiplayer game for the Flipper Zero, best played with the VGM. Here's a video tutorial: https://www.youtube.com/watch?v=Qp7qmYMfdUA
 
 ## Requirements
-
 - WiFi Developer Board, Raspberry Pi, or ESP32 device with the FlipperHTTP flash: https://github.com/jblanked/FlipperHTTP
 - 2.4 GHz WiFi access point
 
@@ -21,7 +20,7 @@ FlipWorld and FlipSocial are connected. Your login information is the same in bo
 - **Press/Hold RIGHT**: Turn right if not already facing right, then walk right if the button is still pressed.
 - **Press/Hold UP**: Walk up.
 - **Press/Hold DOWN**: Walk down.
-- **Press OK**: Attack/Teleport (set to attack until all enemies are defeated).
+- **Press OK**: Interact/Attack/Teleport (set to attack until all enemies are defeated and interact when colliding with NPCs)
 - **HOLD OK**: In-Game Menu.
 - **Press BACK**: Leave the menu.
 - **HOLD BACK**: Exit the game.
@@ -47,6 +46,10 @@ If an enemy attacks you, your health decreases by the enemy's strength (attack p
 
 An enemy attack registers if the enemy is facing you and collides with you. However, to attack an enemy successfully, the enemy must be facing away from you, and you must collide with them while pressing "OK".
 
+**NPCs**
+
+NPCs are friendly characters that players can interact with. Currently, you can interact with them by clicking "OK" while colliding with them.
+
 ## Short Tutorial
 
 1. Ensure your WiFi Developer Board and Video Game Module are flashed with FlipperHTTP.
@@ -71,11 +74,12 @@ An enemy attack registers if the enemy is facing you and collides with you. Howe
 - World expansion
 
 **v0.5**
-- New game features
-- Custom Controller Support
+- Stability patch
+- NPCs
 
 **v0.6**
-- ???
+- New game features
+- Custom Controller Support
 
 **v0.7**
 - ???

+ 7 - 0
game/npc.c

@@ -90,6 +90,13 @@ static void npc_render(Entity *self, GameManager *manager, Canvas *canvas, void
     // Get the position of the NPC
     Vector pos = entity_pos_get(self);
 
+    int x_pos = pos.x - camera_x - npc_context->size.x / 2;
+    int y_pos = pos.y - camera_y - npc_context->size.y / 2;
+
+    // check if position is within the screen
+    if (x_pos + npc_context->size.x < 0 || x_pos > SCREEN_WIDTH || y_pos + npc_context->size.y < 0 || y_pos > SCREEN_HEIGHT)
+        return;
+
     // Choose sprite based on direction
     Sprite *current_sprite = NULL;
     if (npc_context->direction == ENTITY_LEFT)