LilaShiba / spaceTurtles

Home Page:https://kyle1james.github.io/spaceTurtles/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<title>πŸš€ Space Adventure with Python Turtle 🐒</title> <style> body { background-color: #0D0221; color: #F7A8B8;
}
h1, h2, h3 {
    color: #55CDFC; 
}
details {
    background-color: #0B0C10;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}
pre {
    background-color: #1F2833;
    color: #E7E7E7; 
    padding: 10px;
    border-radius: 5px;
}
code {
    color: #F7A8B8; 
}
</style>

πŸš€πŸ’₯ Space Adventure with Python Turtle 🐒

Hello, young coder! πŸ‘‹πŸ‘Ύ Are you ready for an exciting journey to create a beautiful space scene using Python?

🎯 Objective

Your mission is to create a Space Adventure using Python's turtle module. You will draw a night sky filled with stars 🌠, a beautiful planet 🌍, and a spaceship πŸ›Έ ready for a journey into the unknown!


πŸ“ Instructions

1. Set Up Your Project πŸŒŸπŸ’»

Create a new Python file and call it `space_adventure.py`.

Import the turtle module like so:

Click for Hint
import turtle
# create a new turtle
space_turtle = turtle.Turtle()

2. Draw Stars in the Sky 🌠🌌

We'll start by painting the canvas black, setting our turtle color to white, and creating a bunch of stars.

Click for Hint
# function to draw a star
def draw_star(turtle, size):
    for _ in range(5):
        turtle.forward(size)
        turtle.right(144)

Can you use a loop to draw multiple stars at random places?


3. Draw a Planet πŸŒπŸŒ‘

Now, let's draw a big, beautiful planet. You can choose the color!

Click for Hint
# function to draw a circle (for our planet)
def draw_planet(turtle, size, color):
    turtle.penup()
    turtle.goto(0, -size)
    turtle.pendown()
    turtle.color(color)
    turtle.begin_fill()
    turtle.circle(size)
    turtle.end_fill()

4. Draw a Spaceship πŸš€πŸ›Έ

Last but not least, let's draw a spaceship ready for take-off!

Click for Hint
def draw_spaceship(turtle, size):
    turtle.penup()
    turtle.goto(-size/2, -size*2)
    turtle.color("grey")
    turtle.pendown()
    turtle.begin_fill()

    for _ in range(2):
        turtle.forward(size)
        turtle.right(60)
        turtle.forward(size)
        turtle.right(120)
    turtle.right(60)
    turtle.forward(size)

    turtle.end_fill()

5. Show Off Your Creation! πŸ–ΌοΈπŸŽ†

Once you've drawn your stars, planet, and spaceship, it's time to admire your work! Complete your code with this line to hold the drawing screen open:

turtle.done()

βœ¨πŸ’« That's It!

Congrats, explorer! πŸ₯³πŸ‘ You've just created a stunning space adventure using Python and Turtle!

Remember, this is your universe. You can add more stars, planets, or even a fleet of spaceships. Let your imagination run wild! πŸ’­βœ¨

Happy Coding! πŸŽ‰πŸŽŠ

About

https://kyle1james.github.io/spaceTurtles/


Languages

Language:Python 100.0%