This content originally appeared on DEV Community and was authored by Sai Ashish
A Warm Welcome to the Python Intermediate Projects Series??♂️
My name is Sai Ashish and today, I'm dropping one of the most favorite builds of all time — The Among Us Crewmate Build ?
How pumped are you for this project? If you are as psyched as I am, show some love on this article right now ?
This Is What We Are Going to Be Building Today:
The Among Us Crewmate Build ?
Through This Project, You Are Going to Learn About:
1. What is Among Us?
2. The Turtle Module
3. Basics of Python: Functions
4. Implementation of the Among Us character with detailed explanation
You can access the exclusive theory used in this project here. Don't forget to smash the star button if it provided value to you ?
What is Among Us?
Among Us is an online multiplayer social deduction game developed and published by American game studio Innersloth. It was released on iOS and Android devices in June 2018 and on Windows in November 2018, featuring cross-platform play between these platforms. The game was also released on the Nintendo Switch in December 2020, and has planned releases for the Xbox One and Xbox Series X and Series S in 2021.
The game takes place in a space-themed setting, in which players each take on one of two roles, most being Crewmates, and a predetermined number being Impostors. The goal of the Crewmates is to identify the Impostors, eliminate them, and complete tasks around the map; the Impostors' goal is to covertly sabotage and kill the Crewmates before they complete all of their tasks. Players suspected to be Impostors may be eliminated via a plurality vote, which any player may initiate by calling an emergency meeting (except during a crisis) or reporting a dead body. Crewmates win if all Impostors are eliminated or all tasks are completed whereas Impostors win if there is an equal number of Impostors and Crewmates, or if critical sabotage goes unresolved.
Source: Wikipedia | Among Us
Time to Draw✏
To draw any character in turtle, you've to envision the path of your pen. What strokes is it going to have? Which direction it would move? Where does it need to take a curve?
You got to write the command, set the parameters, and run it until you get your desired result.
For this sketch, we would use the turtle module of python. turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas. You can imagine the turtle as a magical pen that draws anything you wish for as instructed to.
Let's import turtle into our program and unleash its creative functions.
import turtle
Now, let's decide what color of crewmate you'd like to draw. For this project, I'm choosing the basic Red one, but you are free to choose any color you like. For the glass, choose blue, preferably the Hexcode: #9acedc shade.
To draw the Among Us character, we divide the sketch into 3 parts:
1. The Body
2. The Glass
3. The Bag
Assigning function name as 'body' for the body part, 'glass' for the glass and 'bag' to draw the bag.
We activate the turtle (our drawing pen) using the Turtle() function and the virtual canvas using the getscreen() function.
s = turtle.getscreen()
t = turtle.Turtle()
Setting the size of the pen to 20.
t.pensize(20)
Part 1: Drawing the Body
Setting the fillcolor to the body color we decided earlier (Red) and calling the begin fill function.
Remember: begin_fill() is to be called just before drawing a shape to be filled
t.fillcolor(BODY_COLOR)
t.begin_fill()
Step 1: The Right Side of the Body
# right side
t.right(90)
t.forward(50)
t.right(180)
t.circle(40, -180)
t.right(180)
t.forward(200)
- Initialising the tip of the pen to right and rotating it 90 degrees clockwise. Now, The tip of the pen faces the downward direction.
- Drawing a line of distance 50 in the forward direction.
- Flipping the orientation of the pen by 180 degrees (facing the upward direction).
- We want to draw a semi-circle in the counterclockwise direction. We set the extent(the angle that determines which part of the circle is drawn) to -180 to instruct our pen that we are drawing a semi-circle. A radius of +40 indicates radius 40 in the counterclockwise direction.
- Flipping the orientation of the pen by 180 degrees.
- Drawing a line of distance 200.
Step 2: The Head Curve
# head curve
t.right(180)
t.circle(100, -180)
- Flipping the orientation of the pen by 180 degrees.
- Drawing a semi-circle with a radius of 100, in the counterclockwise direction.
Step 3: The Left Side of the Body
# left side
t.backward(20)
t.left(15)
t.circle(500, -20)
t.backward(20)
t.circle(40, -180)
t.left(7)
t.backward(50)
- Moving backward (opposite direction) by distance 20.
- Turning the tip of the pen left by 15 degrees. This gives the slight bump effect.
- Drawing an arc of a circle with radius 500, counterclockwise and extent of -20.
- Again, moving backward by distance 20.
- Drawing a semi-circle with extent -180, radius 40 in the counterclockwise direction. This makes the left foot of the crewmate.
- Draw a line to complete the leg by drawing in the backward direction with a distance of 50.
Step 4: Drawing The Hip & Filling The Color
t.up()
t.left(90)
t.forward(10)
t.right(90)
t.down()
t.right(240)
t.circle(50, -70)
t.end_fill()
This part gets a little tricky. But, all you've to do is
- Lift your pen up using up() function.
- Turn the tip of the pen to left by 90 degrees.
- Bring the pen forward by 10 degrees.
- Turn the tip of the pen right by 90 degrees.
- Put the pen down to draw.
- Turn the tip right by 240 degrees.
- Draw an arc of a circle with an extent -70, radius 50 in the counterclockwise direction.
- Finally, we end the fill by calling the end_fill() function.
Part 2: Drawing The Glass
Step 1: Repositioning and Drawing the Arc
t.up()
t.right(230)
t.forward(100)
t.left(90)
t.forward(20)
t.right(90)
t.down()
t.fillcolor(GLASS_COLOR)
t.begin_fill()
- Setting the appropriate position by lifting the pen up, turning the tip right 230 degrees, moving forward a distance of 100, turning left by 90 degrees, moving forward by a distance of 20, and putting the pen down.
- Initialising the Glass color and the begin_fill statement as declared in the Body.
t.right(150)
t.circle(90, -55)
Step 2: Adding a Curve and Moving Ahead
t.right(180)
t.forward(1)
t.right(180)
t.circle(10, -65)
t.right(180)
t.forward(110)
t.right(180)
- Turning the orientation of the tip right by 180 degrees, forward by a distance of 1, again turning the orientation by 180, drawing a curve using a circle of radius 10, counterclockwise and extent of -65. This draws the left arc of the glass shaped like '('.
- Moving forward by a distance of 110 and turning right by 180 degrees to draw the top half of the glass.
Step 3: Drawing the Arc, Finishing the Curve, and Filling Color
t.circle(50, -190)
t.right(170)
t.forward(80)
t.right(180)
t.circle(45, -30)
t.end_fill()
- The first 3 lines draw the ')' part of the glass, the next two complete the curve to the starting point, and end_fill() fills the glass with color.
Part 3: Drawing The Bag
By this point in the article, you must've gotten the hang of drawing using turtle.
Similar to the above two parts, the bag is also constructed as:
Step 1: Reposition and Bottom of Bag
t.up()
t.right(60)
t.forward(100)
t.right(90)
t.forward(75)
t.fillcolor(BODY_COLOR)
t.begin_fill()
t.down()
t.forward(30)
t.right(255)
- Lifting the pen, turning right, moving forward to come down to the leg, and turning right, moving forward to reach the point to start the bag from.
- Initialing the color as done in the above parts.
- Putting the pen down, creating a stroke by moving forward and turning right.
Step 2: Finishing the Bag and Adding Color
t.circle(300, -30)
t.right(260)
t.forward(30)
t.end_fill()
- Drawing the curve using circle(), turning the tip right, and adding a stroke to complete our character!
Assembling it all together:
body()
glass()
bag()
Adding t.screen.exitonclick() at the end will end the turtle screen when we press the ❌ sign.
The Final Source Code for Among Us Crewmate Build:
And we did it! I know that this article got a bit long, but the concept covered would help you draw any desired character with ease??? As a gift for staying till now, you get access to the source code to this project here. Do hit the twinkle star, if this article provided value to you ?
While you're at it, consider giving this blog the maximum love you can and I promise to give you such value bombs every week ? Until then, take care ??♂️
Bonus Insights by The Insightful Coder :
Interested in Building Creative Beginner-Level Python Projects??: Check out the Python Projects for Beginners Series?
Interested in Building Your Own Artificial Intelligence Projects using Python?: Check out the Python AI Series?
Wanna Discover Some Valuable Tech-Hacks ??: Check out the Tech-Hacks for Everybody Series?
Wanna Interact With Me ??♂️? Connect With Me on Your Favourite Platform Here ??
Find and Download All My Project Source Codes at My Github Repository ?
This content originally appeared on DEV Community and was authored by Sai Ashish
Sai Ashish | Sciencx (2021-03-02T12:30:55+00:00) How to Draw Among Us Character Using Python. Retrieved from https://www.scien.cx/2021/03/02/how-to-draw-among-us-character-using-python/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.