Skip to content

Implement WASD keys as an alternative control scheme #6

Description

@AjaysDevWorkspace

⚡ Feature Request: Add "Shrink" Power-Up

Description:

Introduce a new power-up called “Shrink” that reduces the snake’s length by 3 segments immediately after collecting it. This mechanic helps players escape tight spaces or strategically reset their snake’s size.


🎯 Requirements:

  • Add a new item (e.g., a minus icon or shrinking fruit) that spawns randomly like other power-ups.
  • When collected, the snake’s length should be reduced by 3 segments instantly.
  • If the snake has fewer than 4 segments, it should shrink to a minimum of 1 segment — it should never disappear completely.
  • Optional: Add a short visual cue (flash, shrink animation, or color change) to indicate the effect.

💡 Implementation Hints:

  • The snake’s body is typically stored as an array of segments.
  • Use snake.splice() or a similar method to remove the last 3 segments upon power-up collection.
  • Use a distinct itemType or flag to handle the shrink effect within your collision or power-up logic.

🧩 Files Likely Involved:

  • script.js (or the main game logic file managing snake state)
  • Assets or functions related to power-up spawning and handling

✅ Acceptance Criteria:

  • Power-up item appears randomly on the game board.
  • Snake length reduces by exactly 3 segments upon pickup.
  • Minimum snake size is enforced (cannot drop below 1 segment).
  • No bugs or crashes occur when shrink triggers during movement or power-up stacking.

🧪 Optional Bonus:

  • Display an on-screen indicator or play a short sound when the Shrink power-up is triggered.
  • Track how many times the player has used the Shrink ability for potential future stats or achievements.

Enhancement Type: Gameplay Feature / Power-Up Addition
Component: Game Logic, Power-Up System

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions