A mobile endless runner game built for Android devices following clean architecture principles and Material Design guidelines.
Features
Core Gameplay
- Character Control: Swipe gestures to control character movement
- Left/Right: Change lanes
- Up: Jump over obstacles
- Down: Slide under obstacles
- Endless Running: Character automatically runs forward in an endless loop
- Obstacle Avoidance: Random obstacles that must be avoided using swipes
- Coin Collection: Collect coins for points as you run
Power-ups
- Magnet: Attracts nearby coins automatically
- Shield: Protects character from one obstacle collision
- Speed Boost: Temporarily increases running speed
Audio/Visual Features
- Background music that loops continuously during gameplay
- Sound effects for actions (coin collection, jumps, collisions, power-up activation)
- Repeating background environment for endless running feel
- Custom game view with canvas-based rendering
User Interface
- Home Screen: Start game, settings, and profile options
- Game Screen: Real-time game view with score, coins, and power-up indicators
- Pause/Resume: Ability to pause and resume gameplay
- Game Over Screen: Displays final score, coins collected, and restart option
- Profile Screen: View player statistics
- Settings Screen: Configure audio and game preferences
Architecture
The app follows clean architecture principles with clear separation of concerns:
Domain Layer
GameState: Core game state data modelGameRepository: Repository interface for game data operationsGameUseCase: Business logic for game operations
Data Layer
GameRepositoryImpl: Implementation of game repositoryGameEngine: Core game engine handling game loop, collision detection, and object generationAudioManager: Handles background music and sound effects
Presentation Layer
MainActivity: Main activity with bottom navigationHomeFragment: Home screen with game start optionsGameFragment: Game screen with swipe gesture handlingProfileFragment: Player profile and statisticsSettingsFragment: Game settings and preferencesGameView: Custom view for rendering game elements
Technical Implementation
Dependencies
- Navigation Component: For fragment navigation
- Material Design: For UI components and theming
- ViewBinding: For type-safe view access
- Coroutines: For asynchronous operations and game loop
- Custom Canvas Drawing: For game rendering
Game Engine Features
- Game Loop: Runs at ~60 FPS for smooth gameplay
- Collision Detection: Real-time collision detection between character and obstacles
- Object Generation: Random generation of obstacles, coins, and power-ups
- State Management: Reactive state management using StateFlow
- Gesture Handling: Swipe gesture detection for character control
Performance Considerations
- Optimized rendering with custom canvas drawing
- Efficient collision detection algorithms
- Memory management for game objects
- Smooth 60 FPS gameplay on mid-range devices
Requirements Met
✅ Functional Requirements - Character automatically runs forward - Swipe controls for movement (left/right lanes, up jump, down slide) - Random obstacle generation and avoidance - Coin collection system - Power-up system (Magnet, Shield, Speed Boost) - Background music and sound effects - Repeating background environment
✅ Non-Functional Requirements - Performance: Smooth gameplay at 60 FPS - Usability: Responsive swipe gestures with minimal input lag - Scalability: Modular architecture for easy expansion - Compatibility: Supports Android 10+ (API 24+)
✅ User Interface Requirements - Home screen with navigation options - Game screen with real-time gameplay - Pause/resume functionality - Game over screen with restart option
Future Enhancements
The architecture supports easy addition of: - Leaderboards and achievements - Customizable characters and skins - Social sharing of scores - Additional power-ups and obstacles - Multiple game themes/levels - Online multiplayer features
Getting Started
- Clone the repository
- Open in Android Studio
- Build and run on Android device or emulator
- Use swipe gestures to control the character and avoid obstacles
Controls
- Swipe Left/Right: Move between lanes
- Swipe Up: Jump over obstacles
- Swipe Down: Slide under obstacles
- Tap Pause: Pause/resume game
- Tap Restart: Restart after game over