Skip to content

Conversation

@Ayush3941
Copy link

🚀 Feature: Initial Kivy-Based Snake Game UI

🎯 Summary

This PR introduces the first working version of the Snake Game built using the Kivy framework, ported and refactored from the older Tkinter version. It sets up the core game loop, movement logic, food spawning, and a polished UI that is scalable across desktop and mobile devices.


✅ Features Implemented

  • 🐍 Snake mechanics: Directional control, growth on food collision, and self-collision detection.

  • 🍎 Food logic: Random spawning of food avoiding snake body.

  • 💥 Game over conditions: Collision with self or boundaries triggers reset.

  • 💡 UI updates:

    • Real-time score and high score display.
    • Responsive layout using BoxLayout.
    • Clear separation between game canvas and UI elements.
  • 🧼 Code structured with reusable SnakeGame class and proper widget hierarchy.


🛠️ Technical Notes

  • Removed invalid use of id in Python code (id is reserved for .kv files only).
  • Labels for score tracking are passed as constructor arguments to avoid Kivy id errors.
  • Game loop runs via Clock.schedule_interval, and movement updates the canvas in real-time.
  • Canvas drawing handled through InstructionGroup methods: Color, Rectangle, etc.

📦 Next Steps

  • Add visual polish: custom assets for snake/food.
  • Implement pause/resume functionality.
  • Add a persistent local leaderboard with Kivy storage.
  • Consider using .kv files for cleaner layout abstraction.

🧪 Status

✅ Functional prototype complete
🧪 Tested on: Desktop Linux (Full-screen + Windowed)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant