diff --git a/README.md b/README.md new file mode 100644 index 0000000..e9019c7 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# 🚀 Rocket Launch Animation + +## What You'll Create +An animated rocket that launches into space with a planet in the background! + +## How to Run + +### Option 1: Using Python IDLE (Recommended for Beginners) +1. Open **Python IDLE** + - **Mac**: Press `⌘ + Space`, type "IDLE", press Enter + - **Windows**: Press `⊞ + R`, type "idle", press Enter + +2. In IDLE, click **File → Open...** + +3. Navigate to this folder and select **main.py** + +4. Click **Run → Run Module** or press **F5** + +5. Watch your rocket launch! 🚀 + +### Option 2: Using Terminal/Command Prompt +```bash +cd "Rocket Launch/rocket_launch" +python3 main.py +``` + +## What the Code Does + +### Global Variables +- `screen_size = 400` - Sets the window size to 400x400 pixels +- `rocket_y` - Controls the rocket's vertical position (starts near bottom) + +### Functions + +#### `draw_rocket()` +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -_background()` +- Sets the backgrou- Sets the backgrou-- Draws the planet at the bottom center of the screen + +#### `setup()` +- Creates a 400x400 pixel window +- Sets image mode to CENTER (images are positioned from their center) +- Load- Load- Load- Load- Load- Load- Load- Load- Load- Load- Loom- Load- Load- Load- Load- Load- Load- Load- Load- Load- Lohe background +- Then draws the rocket on top + +## Customization Ideas + +Try modifying the code tTry modifying the code tTry modifying the codeed +Try modifying the code tTry mod line: +```python +rocket_y = rocket_y - 5 # Try rocketr faster, -2 for slower +``` + +### Use a Different Planet +In `setup()`, change the planet image: +```python +planet = load_image('purple_planet.png') # or 'orange_planet.png' or 'moon.png' +``` + +### Add Stars +Add this to `draw_background()`: +```python +for i in range(50): + x = randint(0, width) + y = randint(0, height) + fill(255) + circle(x, y, 2) +``` + +### Change Background Color +In `draw_background()`, change: +```python +background(0, 0, 0) # Black space +# Try: background(25, 25, 112) for midnight blue +# Or: background(75, 0, 130) for indigo +``` + +## Troubleshooting + +### "No module named 'p5'" +Install p5 by running in terminal: +```bash +pip3 install p5 +``` + +########################### sure all image files are in the same folder as `main.py`: +- ✅ planet.png +- ✅ rocket.png +- ✅ moon.png (opti- ✅ moon.png (opti- net.png (o- ✅ moon.png (optle_planet.png (optional) + +### Window Doesn't Open +Check for error messages in red text. Common issues: +- Missing images +- Typo in code +- p5 not installed + +## Learn More +This project uses the *This project uses the *Th which makes it easy to create animationsThis proeractive graphics! + +Happy coding! 🎉