-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Introduce a new power-up mechanic where the snake slows down to 50% of its current speed for 3 seconds upon collecting a special item or triggering a condition.
This will be part of Version 2 of the game, where we add more dynamic features and fun challenges.
🎯 Requirements:
Add a new item/power-up (e.g., "slow fruit" or speed modifier).
When collected:
The snake's speed should decrease by 50%.
Effect should last exactly 3 seconds, then revert to normal.
Should not interfere with the current game mechanics or power-ups.
Prevent repeated stacking if another slow item is picked up during the effect.
Optional: Add a visual cue (e.g., different snake color or screen border) to indicate slow mode is active.
💡 Implementation Hints:
Snake speed is likely controlled by a timing loop or frame delay. Find that and apply a temporary change.
Use setTimeout to reset speed after 3000ms.
Add a flag like isSlowedDown to prevent re-triggering during active slowdown.
Consider separating power-up logic into its own function for scalability.
🧩 Files Likely Involved:
script.js (main game loop, input handling, power-up logic)
✅ Acceptance Criteria:
Snake slows down immediately after picking up the item.
Speed returns to normal exactly 3 seconds later.
Game does not crash or behave unexpectedly.
Code is clean and commented where needed.