Session 2 Welcome Back! Arcade Arcade is a library that we will - - PowerPoint PPT Presentation

session 2 welcome back arcade
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Session 2 Welcome Back!

slide-2
SLIDE 2

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!

slide-3
SLIDE 3

#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)

slide-4
SLIDE 4

#2: Open Window

slide-5
SLIDE 5

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")

slide-6
SLIDE 6

#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()

slide-7
SLIDE 7

#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()

slide-8
SLIDE 8

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

slide-9
SLIDE 9

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.
slide-10
SLIDE 10

Draw Something!

slide-11
SLIDE 11

Position (Coordinates)

slide-12
SLIDE 12

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)

slide-13
SLIDE 13

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

slide-14
SLIDE 14

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!

slide-15
SLIDE 15

Now...what will we draw? Pull out last week’s sketches and use them as a guide!

slide-16
SLIDE 16

Don’t forget to add a comment for every piece

  • f the drawing!