Skip to content

🐍 Feature Request: Add Power-Up – “Shrink” (Reduce Snake Length by 3 Segments) #4

@AjaysDevWorkspace

Description

@AjaysDevWorkspace

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

🎯 Requirements:

  • Add a new item (e.g., a minus icon or shrinking fruit) that appears randomly like other power-ups.
  • When the player collects the item:
    • Reduce the snake’s length by 3 segments instantly.
    • If the snake is shorter than 4 segments, reduce it to a minimum of 1 segment (do not let it disappear).
  • Optional: Add a brief visual effect (flash, shrink animation, etc.) when the effect occurs.

💡 Implementation Hints:

  • The snake body is usually stored as an array of segments.
  • Use snake.splice() or similar to remove the last 3 segments when the power-up is collected.
  • Use a flag or item type to trigger the shrink effect in your collision logic.

🧩 Files Likely Involved:

  • script.js or wherever your game logic and snake state are managed
  • Asset or function that handles spawning of power-ups

✅ Acceptance Criteria:

  • Item appears randomly on the board
  • Snake length reduces by exactly 3 segments on pickup
  • Minimum snake size is enforced (snake cannot vanish)
  • No bugs or crashes when shrink occurs during movement or power-up stacking

🧪 Optional Bonus:

  • Show a small on-screen indicator or sound when the shrink is triggered
  • Track how many times the player has used Shrink

🏷 Labels:

hacktoberfest, good first issue, enhancement, game mechanics

Let us know if you'd like to be assigned to this issue or explore other power-up ideas!

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions