david-wolgemuth / xyzplore

game !! explore and create dynamic world, create characters, solve challenges
https://david-wolgemuth.github.io/xyzplore/?t=about-homepage
1 stars 1 forks source link

add mosquito ray #3

Open david-wolgemuth opened 4 months ago

david-wolgemuth commented 4 months ago

collect mosquito / bugs / etc from grass tiles ?? bug catching item drop bugs to distract / attract bats


Certainly! Below is an outline and a GitHub issue template for adding mosquito ray, bug collection, bug catching item, and the ability to drop bugs to distract/attract bats.


GitHub Issue Template

Title: Add Mosquito Ray #3, Bug Collection, Bug Catching Item, and Bug Distraction/Attraction Mechanics

Description: Enhance the game with new features to add more depth and strategy, including a new enemy type (Mosquito Ray), mechanics for collecting bugs from grass tiles, a bug catching item, and the ability to drop bugs to distract or attract bats.


Steps to Complete:

  1. Add Mosquito Ray #3:

    • Create a new enemy type (Mosquito Ray):

      • Define the Mosquito Ray entity with unique properties and behaviors.
      • Implement movement and attack logic for the Mosquito Ray similar to the bat but with its own patterns.
      /**
      * Moves in random direction
      */
      moveMosquitoRay = (mosquitoRay) => {
      const { x, y } = mosquitoRay;
      
      const directions = randomSort([
       Direction.UP_LEFT,
       Direction.LEFT,
       Direction.DOWN_LEFT,
       Direction.DOWN_RIGHT,
       Direction.RIGHT,
       Direction.UP_RIGHT,
      ]);
      
      for (const direction of directions) {
       const delta = getHexGridDelta(y, direction);
       if (this.canMoveNPC(x, y, delta.x, delta.y)) {
         return {
           ...mosquitoRay,
           x: mosquitoRay.x + delta.x,
           y: mosquitoRay.y + delta.y,
         };
       }
      }
      console.warn("Mosquito Ray is stuck", mosquitoRay);
      return mosquitoRay;
      }
  2. Collect Bugs from Grass Tiles:

    • Modify existing grass tile interactions:

      • Update the tile interaction logic to allow for bug collection.
      case GRASS_TILE.key:
      if (this.hasBugCatchingItem()) {
       this.collectItem(BUG_ITEM.key, playerX, playerY);
      }
      break;
  3. Bug Catching Item:

    • Add a new item for bug catching:

      • Define a bug catching net or similar item.
      • Implement logic to check if the player has the bug catching item.
      hasBugCatchingItem = () => {
      return this.state.inventory.includes(BUG_CATCHING_ITEM.key);
      }
  4. Drop Bugs to Distract/Attract Bats:

    • Implement mechanics for dropping bugs:

      • Allow the player to drop bugs from their inventory.
      • Implement logic to make bats move towards or away from the dropped bugs.
      dropBug = (x, y) => {
      if (this.state.inventory.includes(BUG_ITEM.key)) {
       this.state.inventory = this.state.inventory.filter(item => item !== BUG_ITEM.key);
       this.spawnBugAt(x, y);
      }
      }
      
      spawnBugAt = (x, y) => {
      this.state.bugs.push({ x, y });
      this.attractBats(x, y);
      }
      
      attractBats = (x, y) => {
      this.state.bats.forEach(bat => {
       if (Math.abs(bat.x - x) + Math.abs(bat.y - y) < BAT_ATTRACTION_RADIUS) {
         // logic to move bat towards the bug
       }
      });
      }

Additional Code Examples:


References:


Feel free to modify this template and outline as needed to better fit your project's needs and coding standards.