{"id":23174157,"url":"https://github.com/patrickjamesrepo/accelerometerballbounce","last_synced_at":"2025-04-05T00:26:26.196Z","repository":{"id":261155265,"uuid":"883439372","full_name":"PatrickJamesRepo/AccelerometerBallBounce","owner":"PatrickJamesRepo","description":"Android Accelerometer Sensor Ball Bounce ","archived":false,"fork":false,"pushed_at":"2024-11-05T16:41:29.000Z","size":629,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T08:51:25.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatrickJamesRepo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-05T00:58:57.000Z","updated_at":"2024-11-05T16:41:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"00de0b45-1226-476d-9fa4-e661a33643a5","html_url":"https://github.com/PatrickJamesRepo/AccelerometerBallBounce","commit_stats":null,"previous_names":["patrickjamesrepo/accelerometerballbounce"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJamesRepo%2FAccelerometerBallBounce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJamesRepo%2FAccelerometerBallBounce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJamesRepo%2FAccelerometerBallBounce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJamesRepo%2FAccelerometerBallBounce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrickJamesRepo","download_url":"https://codeload.github.com/PatrickJamesRepo/AccelerometerBallBounce/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247268461,"owners_count":20911140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-18T05:19:27.610Z","updated_at":"2025-04-05T00:26:26.176Z","avatar_url":"https://github.com/PatrickJamesRepo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Alien Launch](alienlaunch.png)\n# Accelerometer UFO Ball Bounce Game\n\nThis project is an Android game that uses the device's accelerometer to control bouncing balls within a constrained area. The game includes multiple interactive features, such as dynamic background transitions, score tracking, and responsive collision detection with pads.\n\n## Features\n\n- **Accelerometer-Based Controls**: Use the device’s accelerometer to control ball movements in real-time.\n- **Dynamic Background Transitions**: The background changes periodically among day, dusk/dawn, and night, creating a visually engaging experience.\n- **Score Management**: Track scores based on successful pad collisions, with scores saved and loaded automatically.\n- **Responsive UI**: Handles different screen sizes and orientations gracefully.\n- **Persistent Game State**: Game state, including scores and balls launched, is saved locally and restored when the app is resumed.\n\n## Technologies Used\n\n- **Java**: Core programming language used for game logic, UI, and sensor integration.\n- **Android SDK**: Provides access to Android-specific features like sensors and SharedPreferences.\n- **Canvas API**: Used for drawing graphics, backgrounds, balls, and pads within the game.\n- **SharedPreferences**: For saving and loading game state, including the number of balls launched and the score.\n- **Accelerometer Sensor**: Controls the ball movement based on device orientation and movement.\n\n## Project Structure\n\nThe project is organized as follows:\n\n- `BackgroundManager`: Manages and cycles through the background images (day, dusk/dawn, and night) every 7 seconds.\n- `Ball`: Represents each ball’s position, velocity, and behavior, including gravity and bouncing.\n- `BallManager`: Manages multiple balls, updates their positions, applies acceleration, and handles drawing.\n- `BouncingBallView`: Main game view that draws backgrounds, pads, and balls, handling interactions and accelerometer events.\n- `Box`: Defines the boundaries within which the balls can bounce.\n- `MainActivity`: Main entry point of the application, managing UI elements, sensor registration, and game state.\n- `Pad`: Represents the moving pads that the balls can collide with, using a UFO-like design.\n- `PadManager`: Manages a collection of pads, handles drawing, updates, and collision checks with balls.\n- `ScoreManager`: Manages and saves the score, loading it when the game is resumed.\n\n## How It Works\n\n1. **Background Transitions**: `BackgroundManager` cycles through background images (day, dusk/dawn, night) to simulate a day-night cycle.\n2. **Ball Physics**: `Ball` class uses gravity and damping to simulate realistic bouncing physics within defined boundaries (`Box`).\n3. **Accelerometer Control**: `BouncingBallView` listens for accelerometer events and adjusts ball velocities based on device orientation.\n4. **Collisions**: When balls collide with `Pad` objects, the score is incremented, and the ball's direction is reversed.\n5. **Score Management**: `ScoreManager` saves the score using `SharedPreferences`, ensuring it persists across sessions.\n\n## Setup\n\n1. Clone the repository:\n   ```bash\n   git clone git@github.com:PatrickJamesRepo/AccelerometerBallBounce.git\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickjamesrepo%2Faccelerometerballbounce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickjamesrepo%2Faccelerometerballbounce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickjamesrepo%2Faccelerometerballbounce/lists"}