commit ab5fe040a9b7cd5d8a066d0f6c4a3b1417a766a6 Author: Lazarev Date: Fri May 29 08:27:52 2026 +0000 Initial commit 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! 🎉 diff --git a/main.py b/main.py new file mode 100644 index 0000000..bc4d301 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +# Import library code +from p5 import * +from random import randint + +# Set up global variables +screen_size = 400 + +# The draw_rocket function goes here + + + +# The draw_background function goes here + + + +def setup(): + # Set up your animation here + size(screen_size, screen_size) + image_mode(CENTER) + global planet + planet = load_image('planet.png') + + +def draw(): + # Things to do in every frame + + + + +run() + + + \ No newline at end of file diff --git a/moon.png b/moon.png new file mode 100644 index 0000000..62930b4 Binary files /dev/null and b/moon.png differ diff --git a/orange_planet.png b/orange_planet.png new file mode 100644 index 0000000..a670636 Binary files /dev/null and b/orange_planet.png differ diff --git a/planet.png b/planet.png new file mode 100644 index 0000000..e37920c Binary files /dev/null and b/planet.png differ diff --git a/purple_planet.png b/purple_planet.png new file mode 100644 index 0000000..76bf52e Binary files /dev/null and b/purple_planet.png differ diff --git a/rocket.png b/rocket.png new file mode 100644 index 0000000..970fbec Binary files /dev/null and b/rocket.png differ