Session 2 Welcome Back! Arcade Arcade is a library that we will - - PowerPoint PPT Presentation
Session 2 Welcome Back! Arcade Arcade is a library that we will - - PowerPoint PPT Presentation
Session 2 Welcome Back! Arcade Arcade is a library that we will need to import to the top of every program we write from this point on. It helps us draw pictures and build games! #1: Import Arcade 1 """ 2 This is a sample
Arcade
Arcade is a library that we will need to import to the top of every program we write from this point on. It helps us draw pictures and build games!
#1: Import Arcade
1 2 3 4 5 6 7 """ This is a sample program to show how to draw using the Python programming language and the Arcade library. """ # Import the "arcade" library import arcade
The import statement must always be the very first line of code at the top of every program (excluding comments)
#2: Open Window
Did you see that?
1 2 3 4 5 6 7 8 9 10 11 12 13 """ This is a sample program to show how to draw using the Python programming language and the Arcade library. """ # Import the "arcade" library import arcade # Open up a window. # From the "arcade" library, use a function called "open_window" # Set the and dimensions (width and height) # Set the window title to "Drawing Example" arcade.open_window(600, 600, "Drawing Example")
#3: Keep Arcade Running
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 """ This is a sample program to show how to draw using the Python programming language and the Arcade library. """ # Import the "arcade" library import arcade # Open up a window. # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(600, 600, "Drawing Example") # Keep the window up until someone closes it. arcade.run()
#4: Render Arcade
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # Import the "arcade" library import arcade # Open up a window. arcade.open_window( 600, 600, "Drawing Example") # Set the background color arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BL UE) # Get ready to draw arcade.start_render() # (The drawing code will go here.) # Finish drawing arcade.finish_render() # Keep the window up until someone closes it. arcade.run()
Colors
Red Value Green Value Blue Value Color Black 255 255 255 White 127 127 127 Grey 255 Red 255 Green 255 Blue 255 255 Yellow
Colors
To pick color you have 2 options:
- 1. Look at the API documentation at
http://arcade.academy/arcade.color.html and specify by name, e.g. arcade.color.AQUAMARINE
- 2. Specify the RGB or RGBA color.
Draw Something!
Position (Coordinates)
Shapes
# Left of 5, right of 35 # Top of 590, bottom of 570 #bitter lime color arcade.draw_lrtb_rectangle_filled(5, 35, 590, 570, arcade.color.BITTER_LIME)
Activity 1: drawing_shapes.py
Once you’ve run drawing_shapes.py, change around whatever elements of the shapes you want, including:
- What text displays when the window opens
- The background color of the window
- The parameters of each draw function:
○ Width and height of shapes ○ Color of shapes ○ Alpha value of the shapes ○ Angle of the shapes
Activity 2: drawing_picture.py
See your course website for instructions, which are under Session 2. Also see “Hints/Notes” for more information. Use your sketches from last session!
Now...what will we draw? Pull out last week’s sketches and use them as a guide!
Don’t forget to add a comment for every piece
- f the drawing!