Arcade Documentation Release 1.1.0
Paul Vincent Craven
Jul 05, 2017
Contents
1 Learn about it: 3
2 Give feedback: 5
3 Contribute to the development:7 3.1 Examples...... 7 3.1.1 Example Code...... 7 3.1.1.1 Drawing...... 7 3.1.1.2 Animation...... 8 3.1.1.3 Drawing with Loops...... 8 3.1.1.4 User Control...... 8 3.1.1.5 Sprites...... 21 3.1.1.6 Other...... 27 3.2 Installation...... 32 3.2.1 Installation Instructions...... 32 3.2.1.1 Installation on Windows...... 33 3.2.1.2 Installation on the Mac...... 35 3.2.1.3 Installation on Linux...... 36 3.3 API Documentation...... 37 3.3.1 Arcade Package API...... 37 3.3.1.1 Submodules...... 37 3.3.1.2 Arcade Subpackages...... 37 3.4 How to Contribute...... 58 3.4.1 How to Contribute...... 58 3.4.1.1 How to contribute without coding...... 58 3.4.1.2 How to contribute code...... 58 3.4.2 Directory Structure...... 59 3.4.3 How to Compile...... 59 3.4.3.1 Windows...... 59 3.4.3.2 Linux...... 59 3.4.4 How to Submit Changes...... 60 3.5 More Information...... 60 3.5.1 Pygame Comparison...... 60 3.5.2 Suggested Curriculum...... 61 3.5.2.1 Stage 1:...... 61 3.5.2.2 Stage 2:...... 61 3.5.2.3 Stage 3:...... 61
i 3.5.2.4 Stage 4:...... 62 3.5.2.5 Stage 5:...... 62 3.5.2.6 Stage 6:...... 62
4 License 63
ii Arcade Documentation, Release 1.1.0
Arcade is an easy-to-learn Python library for creating 2D video games. It is ideal for people learning to program, or developers that want to code a 2D game without learning a complex framework.
Contents 1 Arcade Documentation, Release 1.1.0
2 Contents CHAPTER 1
Learn about it:
• Installation Instructions • Example Code • Arcade Package API • quick-index • Arcade on PyPi • Pygame Comparison
3 Arcade Documentation, Release 1.1.0
4 Chapter 1. Learn about it: CHAPTER 2
Give feedback:
• GitHub Arcade Issue List • Reddit Discussion Group • Email: [email protected]
5 Arcade Documentation, Release 1.1.0
6 Chapter 2. Give feedback: CHAPTER 3
Contribute to the development:
• How to Contribute • GitHub Source Code for Arcade The status of the build is here:
Examples
Example Code
Drawing
examples/thumbs/drawing_primitives.png
Fig. 3.1: drawing_primitives
examples/thumbs/drawing_with_functions.png
Fig. 3.2: drawing_with_functions
7 Arcade Documentation, Release 1.1.0
examples/thumbs/drawing_text.png
Fig. 3.3: drawing_text
examples/thumbs/array_backed_grid.png
Fig. 3.4: array_backed_grid
Animation
examples/thumbs/bouncing_rectangle.png
Fig. 3.5: bouncing_rectangle
Drawing with Loops
User Control
8 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
examples/thumbs/bouncing_ball.png
Fig. 3.6: bouncing_ball
examples/thumbs/bouncing_balls.png
Fig. 3.7: bouncing_balls
examples/thumbs/radar_sweep.png
Fig. 3.8: radar_sweep
examples/thumbs/drawing_with_loops.png
Fig. 3.9: drawing_with_loops
examples/thumbs/nested_loops_box.png
Fig. 3.10: nested_loops_box
examples/thumbs/nested_loops_bottom_left_triangle.png
Fig. 3.11: nested_loops_bottom_left_triangle
3.1. Examples 9 Arcade Documentation, Release 1.1.0
examples/thumbs/nested_loops_top_right_triangle.png
Fig. 3.12: nested_loops_top_right_triangle
examples/thumbs/nested_loops_top_left_triangle.png
Fig. 3.13: nested_loops_bottom_left_triangle
examples/thumbs/nested_loops_top_right_triangle.png
Fig. 3.14: nested_loops_top_right_triangle
examples/thumbs/shapes.png
Fig. 3.15: shapes
examples/thumbs/snow.png
Fig. 3.16: snow
10 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
User control: Mouse
Listing 3.1: move_mouse.py
1 """
2 This simple animation example shows how to move an item with the mouse, and
3 handle mouse clicks.
4 """
5
6 import arcade
7
8 # Set up the constants
9 SCREEN_WIDTH= 800
10 SCREEN_HEIGHT= 600
11
12 RECT_WIDTH= 50
3.1. Examples 11 Arcade Documentation, Release 1.1.0
13 RECT_HEIGHT= 50
14
15
16 class Rectangle:
17 """ Class to represent a rectangle on the screen """
18
19 def __init__(self, x, y, width, height, angle, color):
20 """ Initialize our rectangle variables """
21
22 # Position
23 self.x=x
24 self.y=y
25
26 # Size and rotation
27 self.width= width
28 self.height= height
29 self.angle= angle
30
31 # Color
32 self.color= color
33
34 def draw(self):
35 """ Draw our rectangle """
36 arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height,
37 self.color, self.angle)
38
39
40 class MyApplication(arcade.Window):
41 """ Main application class. """
42 def __init__(self, width, height):
43 super().__init__(width, height, title="Keyboard control")
44 self.player= None
45 self.left_down= False
46
47 def setup(self):
48 """ Set up the game and initialize the variables. """
49 width= RECT_WIDTH
50 height= RECT_HEIGHT
51 x=0
52 y= RECT_HEIGHT
53 angle=0
54 color= arcade.color.WHITE
55 self.player= Rectangle(x, y, width, height, angle, color)
56 self.left_down= False
57
58 def update(self, dt):
59 """ Move everything """
60 if self.left_down:
61 self.player.angle+=2
62
63 def on_draw(self):
64 """
65 Render the screen.
66 """
67 arcade.start_render()
68
69 self.player.draw()
70
12 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
71 def on_mouse_motion(self, x, y, dx, dy):
72 """
73 Called whenever the mouse moves.
74 """
75 self.player.x=x
76 self.player.y=y
77
78 def on_mouse_press(self, x, y, button, modifiers):
79 """
80 Called when the user presses a mouse button.
81 """
82 print(button)
83 if button == arcade.MOUSE_BUTTON_LEFT:
84 self.left_down= True
85
86 def on_mouse_release(self, x, y, button, modifiers):
87 """
88 Called when a user releases a mouse button.
89 """
90 if button == arcade.MOUSE_BUTTON_LEFT:
91 self.left_down= False
92
93
94 def main():
95 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
96 window.setup()
97 arcade.run()
98
99 main()
3.1. Examples 13 Arcade Documentation, Release 1.1.0
User control: Keyboard
Listing 3.2: move_keyboard.py
1 """
2 This simple animation example shows how to move an item with the keyboard.
3 """
4
5 import arcade
6
7 # Set up the constants
8 SCREEN_WIDTH= 800
9 SCREEN_HEIGHT= 600
10
11 RECT_WIDTH= 50
12 RECT_HEIGHT= 50
14 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
13
14 MOVEMENT_SPEED=5
15
16
17 class Rectangle:
18 """ Class to represent a rectangle on the screen """
19
20 def __init__(self, x, y, width, height, angle, color):
21 """ Initialize our rectangle variables """
22
23 # Position
24 self.x=x
25 self.y=y
26
27 # Vector
28 self.delta_x=0
29 self.delta_y=0
30
31 # Size and rotation
32 self.width= width
33 self.height= height
34 self.angle= angle
35
36 # Color
37 self.color= color
38
39 def draw(self):
40 """ Draw our rectangle """
41 arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height,
42 self.color, self.angle)
43
44 def move(self):
45 """ Move our rectangle """
46
47 # Move left/right
48 self.x+= self.delta_x
49
50 # See if we've gone beyond the border. If so, reset our position
51 # back to the border.
52 if self.x< RECT_WIDTH//2:
53 self.x= RECT_WIDTH//2
54 if self.x> SCREEN_WIDTH- (RECT_WIDTH//2):
55 self.x= SCREEN_WIDTH- (RECT_WIDTH//2)
56
57 # Move up/down
58 self.y+= self.delta_y
59
60 # Check top and bottom boundaries
61 if self.y< RECT_HEIGHT//2:
62 self.y= RECT_HEIGHT//2
63 if self.y> SCREEN_HEIGHT- (RECT_HEIGHT//2):
64 self.y= SCREEN_HEIGHT- (RECT_HEIGHT//2)
65
66
67 class MyApplication(arcade.Window):
68 """
69 Main application class.
70 """
3.1. Examples 15 Arcade Documentation, Release 1.1.0
71 def __init__(self, width, height):
72 super().__init__(width, height, title="Keyboard control")
73 self.player= None
74 self.left_down= False
75
76 def setup(self):
77 """ Set up the game and initialize the variables. """
78 width= RECT_WIDTH
79 height= RECT_HEIGHT
80 x= SCREEN_WIDTH//2
81 y= SCREEN_HEIGHT//2
82 angle=0
83 color= arcade.color.WHITE
84 self.player= Rectangle(x, y, width, height, angle, color)
85 self.left_down= False
86
87 def update(self, dt):
88 """ Move everything """
89 self.player.move()
90
91 def on_draw(self):
92 """
93 Render the screen.
94 """
95 arcade.start_render()
96
97 self.player.draw()
98
99 def on_key_press(self, key, modifiers):
100 """
101 Called whenever the mouse moves.
102 """
103 if key == arcade.key.UP:
104 self.player.delta_y= MOVEMENT_SPEED
105 elif key == arcade.key.DOWN:
106 self.player.delta_y=-MOVEMENT_SPEED
107 elif key == arcade.key.LEFT:
108 self.player.delta_x=-MOVEMENT_SPEED
109 elif key == arcade.key.RIGHT:
110 self.player.delta_x= MOVEMENT_SPEED
111
112 def on_key_release(self, key, modifiers):
113 """
114 Called when the user presses a mouse button.
115 """
116 if key == arcade.key.UP or key == arcade.key.DOWN:
117 self.player.delta_y=0
118 elif key == arcade.key.LEFT or key == arcade.key.RIGHT:
119 self.player.delta_x=0
120
121
122 def main():
123 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
124 window.setup()
125 arcade.run()
126
127 main()
16 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
User control: Joystick
Listing 3.3: move_joystick.py
1 """
2 This simple animation example shows how to move an item with the joystick
3 and game-pad.
4 """
5
6 import arcade
7
8 # Set up the constants
9 SCREEN_WIDTH= 800
10 SCREEN_HEIGHT= 600
11
12 RECT_WIDTH= 50
13 RECT_HEIGHT= 50
14
15 MOVEMENT_MULTIPLIER=5
16 DEAD_ZONE= 0.05
17
18
19 class Rectangle:
20 """ Class to represent a rectangle on the screen """
21
22 def __init__(self, x, y, width, height, angle, color):
23 """ Initialize our rectangle variables """
24
25 # Position
26 self.x=x
27 self.y=y
28
29 # Vector
30 self.delta_x=0
31 self.delta_y=0
32
33 # Size and rotation
34 self.width= width
35 self.height= height
36 self.angle= angle
37
38 # Color
39 self.color= color
40
41 joysticks= arcade.get_joysticks()
42 if joysticks:
43 self.joystick= joysticks[0]
44 self.joystick.open()
45 else:
46 print("There are no Joysticks")
47 self.joystick= None
48
49 def draw(self):
50 """ Draw our rectangle """
51 arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height,
52 self.color, self.angle)
53
54 def move(self):
3.1. Examples 17 Arcade Documentation, Release 1.1.0
55 """ Move our rectangle """
56
57 # Grab the position of the joystick
58 # This will be between -1.0 and +1.0
59
60 if self.joystick: 61 self.delta_x= self.joystick.x * MOVEMENT_MULTIPLIER 62 # Set a "dead zone" to prevent drive from a centered joystick
63 if abs(self.delta_x)< DEAD_ZONE:
64 self.delta_x=0
65 66 self.delta_y=-self.joystick.y * MOVEMENT_MULTIPLIER 67 # Set a "dead zone" to prevent drive from a centered joystick
68 if abs(self.delta_y)< DEAD_ZONE:
69 self.delta_y=0
70
71 # Move left/right
72 self.x+= self.delta_x
73
74 # See if we've gone beyond the border. If so, reset our position
75 # back to the border.
76 if self.x< RECT_WIDTH//2:
77 self.x= RECT_WIDTH//2
78 if self.x> SCREEN_WIDTH- (RECT_WIDTH//2):
79 self.x= SCREEN_WIDTH- (RECT_WIDTH//2)
80
81 # Move up/down
82 self.y+= self.delta_y
83
84 # Check top and bottom boundaries
85 if self.y< RECT_HEIGHT//2:
86 self.y= RECT_HEIGHT//2
87 if self.y> SCREEN_HEIGHT- (RECT_HEIGHT//2):
88 self.y= SCREEN_HEIGHT- (RECT_HEIGHT//2)
89
90
91 class MyApplication(arcade.Window):
92 """
93 Main application class.
94 """
95 def __init__(self, width, height):
96 super().__init__(width, height, title="Keyboard control")
97 self.player= None
98 self.left_down= False
99
100 def setup(self):
101 """ Set up the game and initialize the variables. """
102 width= RECT_WIDTH
103 height= RECT_HEIGHT
104 x= SCREEN_WIDTH//2
105 y= SCREEN_HEIGHT//2
106 angle=0
107 color= arcade.color.WHITE
108 self.player= Rectangle(x, y, width, height, angle, color)
109 self.left_down= False
110
111 def update(self, dt):
112 """ Move everything """
18 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
113 self.player.move()
114
115 def on_draw(self):
116 """
117 Render the screen.
118 """
119 arcade.start_render()
120
121 self.player.draw()
122
123
124 def main():
125 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
126 window.setup()
127 arcade.run()
128
129 main()
Full Joystick Example
Listing 3.4: joystick.py
1 """
2 This simple animation example shows how to move an item with the keyboard.
3 """
4
5 import arcade
6
7 # Set up the constants
8 SCREEN_WIDTH= 800
9 SCREEN_HEIGHT= 600
10
11 RECT_WIDTH= 50
12 RECT_HEIGHT= 50
13
14 MOVEMENT_MULTIPLIER=5
15 DEAD_ZONE= 0.05
16
17
18 class MyApplication(arcade.Window):
19 """
20 Main application class.
21 """
22 def __init__(self, width, height):
23 super().__init__(width, height, title="Keyboard control")
24 self.player= None
25 self.left_down= False
26
27 joysticks= arcade.get_joysticks()
28 if joysticks:
29 self.joystick= joysticks[0]
30 self.joystick.open()
31 self.joystick.on_joybutton_press= self.on_joybutton_press
32 self.joystick.on_joybutton_release= self.on_joybutton_release
33 self.joystick.on_joyhat_motion= self.on_joyhat_motion
34 else:
3.1. Examples 19 Arcade Documentation, Release 1.1.0
35 print("There are no Joysticks")
36 self.joystick= None
37
38 def on_joybutton_press(self, joystick, button):
39 print("Button {} down".format(button))
40
41 def on_joybutton_release(self, joystick, button):
42 print("Button {} up".format(button))
43
44 def on_joyhat_motion(self, joystick, hat_x, hat_y):
45 print("Hat ({}, {})".format(hat_x, hat_y))
46
47 def setup(self):
48 """ Set up the game and initialize the variables. """
49 width= RECT_WIDTH
50 height= RECT_HEIGHT
51 x= SCREEN_WIDTH//2
52 y= SCREEN_HEIGHT//2
53 angle=0
54 color= arcade.color.WHITE
55 self.player= Rectangle(x, y, width, height, angle, color)
56 self.left_down= False
57
58 def update(self, dt):
59 # Grab the position of the joystick
60 # This will be between -1.0 and +1.0
61
62 if self.joystick: 63 self.player.delta_x= self.joystick.x * MOVEMENT_MULTIPLIER 64 # Set a "dead zone" to prevent drive from a centered joystick
65 if abs(self.player.delta_x)< DEAD_ZONE:
66 self.player.delta_x=0
67 68 self.player.delta_y=-self.joystick.y * MOVEMENT_MULTIPLIER 69 # Set a "dead zone" to prevent drive from a centered joystick
70 if abs(self.player.delta_y)< DEAD_ZONE:
71 self.player.delta_y=0
72
73 """ Move everything """
74 self.player.move()
75
76 def on_draw(self):
77 """
78 Render the screen.
79 """
80 arcade.start_render()
81
82 self.player.draw()
83
84
85 def main():
86 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
87 window.setup()
88 arcade.run()
89
90
91 class Rectangle:
92
20 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
93 """ Class to represent a rectangle on the screen """
94
95 def __init__(self, x, y, width, height, angle, color):
96 """ Initialize our rectangle variables """
97
98 # Position
99 self.x=x
100 self.y=y
101
102 # Vector
103 self.delta_x=0
104 self.delta_y=0
105
106 # Size and rotation
107 self.width= width
108 self.height= height
109 self.angle= angle
110
111 # Color
112 self.color= color
113
114 def draw(self):
115 """ Draw our rectangle """
116 arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height,
117 self.color, self.angle)
118
119 def move(self):
120
121 """ Move our rectangle """
122
123 # Move left/right
124 self.x+= self.delta_x
125
126 # See if we've gone beyond the border. If so, reset our position
127 # back to the border.
128 if self.x< RECT_WIDTH//2:
129 self.x= RECT_WIDTH//2
130 if self.x> SCREEN_WIDTH- (RECT_WIDTH//2):
131 self.x= SCREEN_WIDTH- (RECT_WIDTH//2)
132
133 # Move up/down
134 self.y+= self.delta_y
135
136 # Check top and bottom boundaries
137 if self.y< RECT_HEIGHT//2:
138 self.y= RECT_HEIGHT//2
139 if self.y> SCREEN_HEIGHT- (RECT_HEIGHT//2):
140 self.y= SCREEN_HEIGHT- (RECT_HEIGHT//2)
141
142 main()
Sprites
Player Movement
3.1. Examples 21 Arcade Documentation, Release 1.1.0
examples/thumbs/sprite_collect_coins.png
Fig. 3.17: sprite_collect_coins
examples/thumbs/sprite_collect_coins.png
Fig. 3.18: sprite_move_keyboard
examples/thumbs/sprite_face_left_or_right.png
Fig. 3.19: sprite_face_left_or_right
examples/thumbs/sprite_collect_coins.png
Fig. 3.20: sprite_move_joystick
22 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
Sprite Movement
examples/thumbs/sprite_collect_coins_move_down.png
Fig. 3.21: sprite_collect_coins_move_down
examples/thumbs/sprite_collect_coins_move_bouncing.png
Fig. 3.22: sprite_collect_coins_move_bouncing
examples/thumbs/sprite_collect_coins_move_circle.png
Fig. 3.23: sprite_collect_coins_move_circle
Levels
Different Levels
Listing 3.5: sprite_collect_coins_diff_levels.py
1 """
2 Sprite Collect Coins
3
4 Simple program to show basic sprite usage.
5
6 Artwork from http://kenney.nl
7 """
8 import random
9 import arcade
10
11 SPRITE_SCALING= 0.5
12
13 SCREEN_WIDTH= 800
14 SCREEN_HEIGHT= 600
15
3.1. Examples 23 Arcade Documentation, Release 1.1.0
16
17 class FallingCoin(arcade.Sprite):
18 """ Simple sprite that falls down """
19
20 def update(self):
21 """ Move the coin """
22
23 # Fall down
24 self.center_y-=2
25
26 # Did we go off the screen? If so, pop back to the top.
27 if self.top<0:
28 self.bottom= SCREEN_HEIGHT
29
30
31 class RisingCoin(arcade.Sprite):
32 """ Simple sprite that falls up """
33
34 def update(self):
35 """ Move the coin """
36
37 # Move up
38 self.center_y+=2
39
40 # Did we go off the screen? If so, pop back to the bottom.
41 if self.bottom> SCREEN_HEIGHT:
42 self.top=0
43
44
45 class MyApplication(arcade.Window):
46 """
47 Main application class.
48 """
49
50 def __init__(self, width, height):
51 """ Initialize """
52
53 # Call the parent class initializer
54 super().__init__(width, height)
55
56 # Variables that will hold sprite lists
57 self.all_sprites_list= None
58 self.coin_list= None
59
60 # Set up the player info
61 self.player_sprite= None
62 self.score=0
63
64 # Don't show the mouse cursor
65 self.set_mouse_visible(False)
66
67 # Set the background color
68 arcade.set_background_color(arcade.color.AMAZON)
69
70
71 def level_1(self):
72 for i in range(20):
73
24 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
74 # Create the coin instance
75 coin= arcade.Sprite("images/coin_01.png", SPRITE_SCALING/3)
76
77 # Position the coin
78 coin.center_x= random.randrange(SCREEN_WIDTH)
79 coin.center_y= random.randrange(SCREEN_HEIGHT)
80
81 # Add the coin to the lists
82 self.all_sprites_list.append(coin)
83 self.coin_list.append(coin)
84
85 def level_2(self):
86 for i in range(30):
87
88 # Create the coin instance
89 coin= FallingCoin("images/gold_1.png", SPRITE_SCALING/2)
90
91 # Position the coin
92 coin.center_x= random.randrange(SCREEN_WIDTH) 93 coin.center_y= random.randrange(SCREEN_HEIGHT, SCREEN_HEIGHT * 2) 94
95 # Add the coin to the lists
96 self.all_sprites_list.append(coin)
97 self.coin_list.append(coin)
98
99 def level_3(self):
100 for i in range(30):
101
102 # Create the coin instance
103 coin= RisingCoin("images/gold_1.png", SPRITE_SCALING/2)
104
105 # Position the coin
106 coin.center_x= random.randrange(SCREEN_WIDTH)
107 coin.center_y= random.randrange(-SCREEN_HEIGHT,0)
108
109 # Add the coin to the lists
110 self.all_sprites_list.append(coin)
111 self.coin_list.append(coin)
112
113 def setup(self):
114 """ Set up the game and initialize the variables. """
115
116 self.score=0
117 self.level=1
118
119 # Sprite lists
120 self.all_sprites_list= arcade.SpriteList()
121 self.coin_list= arcade.SpriteList()
122
123 # Set up the player
124 self.player_sprite= arcade.Sprite("images/character.png",
125 SPRITE_SCALING)
126 self.player_sprite.center_x= 50
127 self.player_sprite.center_y= 50
128 self.all_sprites_list.append(self.player_sprite)
129
130 self.level_1()
131
3.1. Examples 25 Arcade Documentation, Release 1.1.0
132 def on_draw(self):
133 """
134 Render the screen.
135 """
136
137 # This command has to happen before we start drawing
138 arcade.start_render()
139
140 # Draw all the sprites.
141 self.player_sprite.draw()
142 self.coin_list.draw()
143
144 # Put the text on the screen.
145 output=f"Score: {self.score}"
146 arcade.draw_text(output, 10, 20, arcade.color.WHITE, 14)
147
148 output=f"Level: {self.level}"
149 arcade.draw_text(output, 10, 35, arcade.color.WHITE, 14)
150
151
152 def on_mouse_motion(self, x, y, dx, dy):
153 """
154 Called whenever the mouse moves.
155 """
156 self.player_sprite.center_x=x
157 self.player_sprite.center_y=y
158
159 def update(self, delta_time):
160 """ Movement and game logic """
161
162 # Call update on all sprites (The sprites don't do much in this
163 # example though.)
164 self.all_sprites_list.update()
165
166 # Generate a list of all sprites that collided with the player.
167 hit_list=\
168 arcade.check_for_collision_with_list(self.player_sprite,
169 self.coin_list)
170
171 # Loop through each colliding sprite, remove it, and add to the score.
172 for coin in hit_list:
173 coin.kill()
174 self.score+=1
175
176 # See if we should go to level 2
177 if len(self.coin_list) ==0 and self.level ==1:
178 self.level+=1
179 self.level_2()
180 # See if we should go to level 3
181 elif len(self.coin_list) ==0 and self.level ==2:
182 self.level+=1
183 self.level_3()
184
185
186 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
187 window.setup()
188
189 arcade.run()
26 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
Bullets
examples/thumbs/sprite_bullets.png
Fig. 3.24: sprite_bullets
examples/thumbs/sprite_bullets_aimed.png
Fig. 3.25: sprite_bullets_aimed
examples/thumbs/sprite_bullets_periodic.png
Fig. 3.26: sprite_bullets_periodic
Platformers
Other
Classes: Starting Template
Listing 3.6: starting_template.py
1 """
2 Starting Template
3
4 Once you have learned how to use classes, you can begin your program with this
5 template.
6
7 A walk-through of this code is available at:
8 https://vimeo.com/168051968
9 """
10 import arcade
11
12 SCREEN_WIDTH= 500
13 SCREEN_HEIGHT= 600
14 BALL_RADIUS= 20
3.1. Examples 27 Arcade Documentation, Release 1.1.0
examples/thumbs/sprite_bullets_random.png
Fig. 3.27: sprite_bullets_random
examples/thumbs/sprite_bullets_enemy_aims.png
Fig. 3.28: sprite_bullets_enemy_aims
examples/thumbs/sprite_move_walls.png
Fig. 3.29: sprite_move_walls
examples/thumbs/sprite_move_scrolling.png
Fig. 3.30: sprite_move_scrolling
examples/thumbs/sprite_move_animation.png
Fig. 3.31: sprite_move_animation
examples/thumbs/sprite_tiled_map.png
Fig. 3.32: sprite_tiled_map
28 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
examples/thumbs/sprite_ramps.png
Fig. 3.33: sprite_ramps
examples/thumbs/sprite_moving_platforms.png
Fig. 3.34: sprite_moving_platforms
examples/thumbs/sprite_collect_coins_background.png
Fig. 3.35: sprite_collect_coins_background
examples/thumbs/timer.png
Fig. 3.36: timer
examples/thumbs/sprite_change_coins.png
Fig. 3.37: sprite_change_coins
examples/thumbs/instruction_and_game_over_screens.png
Fig. 3.38: instruction_and_game_over_screens
3.1. Examples 29 Arcade Documentation, Release 1.1.0
examples/thumbs/asteroid_smasher.png
Fig. 3.39: asteroid_smasher
examples/thumbs/instruction_and_game_over_screens.png
Fig. 3.40: instruction_and_game_over_screens
15
16
17 class MyApplication(arcade.Window):
18 """
19 Main application class.
20
21 NOTE: Go ahead and delete the methods you don't need.
22 If you do need a method, delete the 'pass' and replace it
23 with your own code. Don't leave 'pass' in this program.
24 """
25
26 def __init__(self, width, height):
27 super().__init__(width, height)
28
29 self.ball_x_position= BALL_RADIUS
30 self.ball_x_pixels_per_second= 70
31
32 arcade.set_background_color(arcade.color.WHITE)
33
34 # Note:
35 # You can change how often the animate() method is called by using the
36 # set_update_rate() method in the parent class.
37 # The default is once every 1/80 of a second.
38 # self.set_update_rate(1/80)
39
40 def on_draw(self):
41 """
42 Render the screen.
43 """
44
45 # This command should happen before we start drawing. It will clear
46 # the screen to the background color, and erase what we drew last frame.
47 arcade.start_render()
48
49 # Draw the circle
50 arcade.draw_circle_filled(self.ball_x_position, SCREEN_HEIGHT//2,
51 BALL_RADIUS, arcade.color.GREEN)
52
30 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
53 # Draw the text
54 arcade.draw_text("This is a simple template to start your game.",
55 10, SCREEN_HEIGHT//2, arcade.color.BLACK, 20)
56
57 def update(self, delta_time):
58 """
59 All the logic to move, and the game logic goes here.
60 """
61 # Move the ball 62 self.ball_x_position+= self.ball_x_pixels_per_second * delta_time 63
64 # Did the ball hit the right side of the screen while moving right?
65 if self.ball_x_position> SCREEN_WIDTH- BALL_RADIUS \
66 and self.ball_x_pixels_per_second>0: 67 self.ball_x_pixels_per_second *=-1 68
69 # Did the ball hit the left side of the screen while moving left?
70 if self.ball_x_position< BALL_RADIUS \
71 and self.ball_x_pixels_per_second<0: 72 self.ball_x_pixels_per_second *=-1 73
74 def on_key_press(self, key, key_modifiers):
75 """
76 Called whenever a key on the keyboard is pressed.
77
78 For a full list of keys, see:
79 http://pythonhosted.org/arcade/arcade.key.html
80 """
81
82 # See if the user hit Shift-Space
83 # (Key modifiers are in powers of two, so you can detect multiple
84 # modifiers by using a bit-wise 'and'.)
85 if key == arcade.key.SPACE and key_modifiers == arcade.key.MOD_SHIFT:
86 print("You pressed shift-space")
87
88 # See if the user just hit space.
89 elif key == arcade.key.SPACE:
90 print("You pressed the space bar.")
91
92 def on_key_release(self, key, key_modifiers):
93 """
94 Called whenever the user lets off a previously pressed key.
95 """
96 if key == arcade.key.SPACE:
97 print("You stopped pressing the space bar.")
98
99 def on_mouse_motion(self, x, y, delta_x, delta_y):
100 """
101 Called whenever the mouse moves.
102 """
103 pass
104
105 def on_mouse_press(self, x, y, button, key_modifiers):
106 """
107 Called when the user presses a mouse button.
108 """
109 pass
110
3.1. Examples 31 Arcade Documentation, Release 1.1.0
111 def on_mouse_release(self, x, y, button, key_modifiers):
112 """
113 Called when a user releases a mouse button.
114 """
115 pass
116
117 window= MyApplication(SCREEN_WIDTH, SCREEN_HEIGHT)
118
119 arcade.run()
Examples to-do list
These are examples we need, that haven’t been created. • Show how to do ‘levels’ based on list length hitting 0 • Show how to do ‘levels’ based on timer • Animating snow • Move game controller • Joystick calls • Background music • Recursive examples • Rotating sprites • Sprite explosions • Destroy all sprites with a property • See if there are any sprites with a property • See if all items have a property • Pong • Centipede • Move between rooms • Physics engine • Enemies that follow the user
Installation
Installation Instructions
Arcade runs on Windows, Mac OS X, and Linux. Arcade requires Python 3.5 or newer. It does not run on Python 2.x. Select the instructions for your platform:
32 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
Installation on Windows
To develop with the Arcade library, we need to install Python, then install Arcade, and finally install a development environment.
Step 1: Install Python
Install Python from the official Python website: https://www.python.org/downloads/ The website gives you the option of downloading two different versions: Version 3.x.x or version 2.x.x. The Arcade library requires Python beginning with 3.x.x. When installing Python, make sure to customize the installation and add Python to the path:
The defaults on the next screen are fine:
Then install Python for all users:
3.2. Installation 33 Arcade Documentation, Release 1.1.0
A video of the installation is below:
Step 2: Install The Arcade Library
Install Arcade The Easy Way
Click the Window button in the lower left of your screen (or hit the window button on your keyboard) and start typing command prompt. Don’t just run the Command Prompt, but instead right-click on it and run as administrator.
Next, type pip install arcade at the command prompt:
34 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
The video below steps through the process:
Install Arcade The Hard Way
If you successfully installed Arcade the easy way, skip this section. If you’d rather download the Arcade library directly off PyPi you can at: https://pypi.python.org/pypi/arcade Or you can get the source code for the library from GitHub: https://github.com/pvcraven/arcade
Step 3: Install A Development Environment
Get and set up one of these development environments: 1. PyCharm. Arguably the most popular option. But with so many features it can be overwhelming when getting started. 2. Sublime. This is more complex to set up for Python, but by far my favorite editor. Spend 20 minutes to watch tutorial videos and you will save a lot of time later. Anaconda is a great Sublime plug-in for doing Python development. 3. Wing (costs money) or Wing 101 (free but less powerful) 4. Or pick your own environment
Installation on the Mac
1. Go to the Python website and download the Mac version that starts with a 3, rather than the one that starts with a Click on the download and install the program. 2. MacOS computers have a terminal window where a user can type commands and interact directly with the com- puter, without any windows or GUI applications popping up. To start the terminal, open Spotlight (Command + Space) and type “Terminal” (without the quotes), then press enter. You can also locate the Terminal program by looking in the “Utilities” folder under your “Applications” folder. 3. Install virtualenv. This allows you to install Python packages without affecting the system-wide Python instal- lation. Run the following command in your terminal. sudo pip3 install virtualenv
3.2. Installation 35 Arcade Documentation, Release 1.1.0
4. Use virtualenv to create a virtual environment specifically for your project by running the following command in your terminal. virtualenv ~/.virtualenvs/arcade 5. Activate the virtualenv you just created. (You may need to do this each time you open a new terminal window. It is possible to make the terminal do this for you each time you open a new window, but that is beyond the scope of these instructions.) source ~/.virtualenvs/arcade/bin/activate 6. Install the Python Arcade Library, by running the following command pip install arcade 7. Download the community edition of PyCharm for the Mac from the Jetbrains website. Double click on the file you downloaded to install it. 8. Create a new project in PyCharm. Because the Mac often has multiple versions of Python installed on it, when creating a project make sure to select version 3.6.
Installation on Linux
Ubuntu 16.04 Instructions
We will use a virtual python environment to install arcade.
apt update&& sudo apt install -y python3-dev python3-pip libjpeg-dev zlib1g-dev sudo pip3 install virtualenv virtualenvwrapper virtualenv ~/.virtualenvs/arcade -p python3 source ~/.virtualenvs/arcade/bin/activate pip install arcade
In order for sound to work we need to install avbin from here: https://github.com/AVbin/AVbin/downloads Download the AVbin 11-alpha4 version. Be sure to download the correct architecture.
cd Download/Location chmod +x install-avbin-linux-x86-64-v11alpha4 #You may have a different architecture sudo ./install-avbin-linux-x86-64-v11alpha4
Issues with avbin?
The libavbin items help with sound. There is an issue getting this library on newer versions of Ubuntu.
sudo apt-get install -y libasound2
36 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
API Documentation
Arcade Package API
Submodules
Window Commands Module
Draw Commands Module
Application Class Module
Geometry Module
Sprite Module
Physics Engines Module
Sound Module
Arcade Subpackages arcade.key package
Mapping of keyboard keys to values.
""" Constants used to signify what keys on the keyboard were pressed. """
# Key modifiers # Done in powers of two, so you can do a bit-wise 'and' to detect # multiple modifiers. MOD_SHIFT=1 MOD_CTRL=2 MOD_ALT=4 MOD_CAPSLOCK=8 MOD_NUMLOCK= 16 MOD_WINDOWS= 32 MOD_COMMAND= 64 MOD_OPTION= 128 MOD_SCROLLLOCK= 256 MOD_ACCEL=2
# Keys BACKSPACE= 65288 TAB= 65289 LINEFEED= 65290 CLEAR= 65291 RETURN= 65293 ENTER= 65293 PAUSE= 65299
3.3. API Documentation 37 Arcade Documentation, Release 1.1.0
SCROLLLOCK= 65300 SYSREQ= 65301 ESCAPE= 65307 HOME= 65360 LEFT= 65361 UP= 65362 RIGHT= 65363 DOWN= 65364 PAGEUP= 65365 PAGEDOWN= 65366 END= 65367 BEGIN= 65368 DELETE= 65535 SELECT= 65376 PRINT= 65377 EXECUTE= 65378 INSERT= 65379 UNDO= 65381 REDO= 65382 MENU= 65383 FIND= 65384 CANCEL= 65385 HELP= 65386 BREAK= 65387 MODESWITCH= 65406 SCRIPTSWITCH= 65406 MOTION_UP= 65362 MOTION_RIGHT= 65363 MOTION_DOWN= 65364 MOTION_LEFT= 65361 MOTION_NEXT_WORD=1 MOTION_PREVIOUS_WORD=2 MOTION_BEGINNING_OF_LINE=3 MOTION_END_OF_LINE=4 MOTION_NEXT_PAGE= 65366 MOTION_PREVIOUS_PAGE= 65365 MOTION_BEGINNING_OF_FILE=5 MOTION_END_OF_FILE=6 MOTION_BACKSPACE= 65288 MOTION_DELETE= 65535 NUMLOCK= 65407 NUM_SPACE= 65408 NUM_TAB= 65417 NUM_ENTER= 65421 NUM_F1= 65425 NUM_F2= 65426 NUM_F3= 65427 NUM_F4= 65428 NUM_HOME= 65429 NUM_LEFT= 65430 NUM_UP= 65431 NUM_RIGHT= 65432 NUM_DOWN= 65433 NUM_PRIOR= 65434 NUM_PAGE_UP= 65434 NUM_NEXT= 65435 NUM_PAGE_DOWN= 65435 NUM_END= 65436
38 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
NUM_BEGIN= 65437 NUM_INSERT= 65438 NUM_DELETE= 65439 NUM_EQUAL= 65469 NUM_MULTIPLY= 65450 NUM_ADD= 65451 NUM_SEPARATOR= 65452 NUM_SUBTRACT= 65453 NUM_DECIMAL= 65454 NUM_DIVIDE= 65455 NUM_0= 65456 NUM_1= 65457 NUM_2= 65458 NUM_3= 65459 NUM_4= 65460 NUM_5= 65461 NUM_6= 65462 NUM_7= 65463 NUM_8= 65464 NUM_9= 65465 F1= 65470 F2= 65471 F3= 65472 F4= 65473 F5= 65474 F6= 65475 F7= 65476 F8= 65477 F9= 65478 F10= 65479 F11= 65480 F12= 65481 F13= 65482 F14= 65483 F15= 65484 F16= 65485 LSHIFT= 65505 RSHIFT= 65506 LCTRL= 65507 RCTRL= 65508 CAPSLOCK= 65509 LMETA= 65511 RMETA= 65512 LALT= 65513 RALT= 65514 LWINDOWS= 65515 RWINDOWS= 65516 LCOMMAND= 65517 RCOMMAND= 65518 LOPTION= 65488 ROPTION= 65489 SPACE= 32 EXCLAMATION= 33 DOUBLEQUOTE= 34 HASH= 35 POUND= 35 DOLLAR= 36 PERCENT= 37
3.3. API Documentation 39 Arcade Documentation, Release 1.1.0
AMPERSAND= 38 APOSTROPHE= 39 PARENLEFT= 40 PARENRIGHT= 41 ASTERISK= 42 PLUS= 43 COMMA= 44 MINUS= 45 PERIOD= 46 SLASH= 47 COLON= 58 SEMICOLON= 59 LESS= 60 EQUAL= 61 GREATER= 62 QUESTION= 63 AT= 64 BRACKETLEFT= 91 BACKSLASH= 92 BRACKETRIGHT= 93 ASCIICIRCUM= 94 UNDERSCORE= 95 GRAVE= 96 QUOTELEFT= 96 A= 97 B= 98 C= 99 D= 100 E= 101 F= 102 G= 103 H= 104 I= 105 J= 106 K= 107 L= 108 M= 109 N= 110 O= 111 P= 112 Q= 113 R= 114 S= 115 T= 116 U= 117 V= 118 W= 119 X= 120 Y= 121 Z= 122 BRACELEFT= 123 BAR= 124 BRACERIGHT= 125 ASCIITILDE= 126
40 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0 arcade.color package
These are colors you can use when drawing. See http://www.colorpicker.com/color-chart/ for visuals on these colors.
""" This module pre-defines several colors.
For a visual color chart, see: http://www.colorpicker.com/color-chart/ """ AERO_BLUE=(201, 255, 229) AFRICAN_VIOLET=(178, 132, 190) AIR_FORCE_BLUE=(93, 138, 168) AIR_SUPERIORITY_BLUE=(114, 160, 193) ALABAMA_CRIMSON=(175,0, 42) ALICE_BLUE=(240, 248, 255) ALIZARIN_CRIMSON=(227, 38, 54) ALLOY_ORANGE=(196, 98, 16) ALMOND=(239, 222, 205) AMARANTH=(229, 43, 80) AMARANTH_PINK=(241, 156, 187) AMARANTH_PURPLE=(171, 39, 79) AMAZON=(59, 122, 87) AMBER=(255, 191,0) SAE=(255, 126,0) AMERICAN_ROSE=(255,3, 62) AMETHYST=(153, 102, 204) ANDROID_GREEN=(164, 198, 57) ANTI_FLASH_WHITE=(242, 243, 244) ANTIQUE_BRASS=(205, 149, 117) ANTIQUE_BRONZE=(102, 93, 30) ANTIQUE_FUCHSIA=(145, 92, 131) ANTIQUE_RUBY=(132, 27, 45) ANTIQUE_WHITE=(250, 235, 215) AO=(0, 128,0) APPLE_GREEN=(141, 182,0) APRICOT=(251, 206, 177) AQUA=(0, 255, 255) AQUAMARINE=(127, 255, 212) ARMY_GREEN=(75, 83, 32) ARSENIC=(59, 68, 75) ARTICHOKE=(143, 151, 121) ARYLIDE_YELLOW=(233, 214, 107) ASH_GREY=(178, 190, 181) ASPARAGUS=(135, 169, 107) ATOMIC_TANGERINE=(255, 153, 102) AUBURN=(165, 42, 42) AUREOLIN=(253, 238,0) AUROMETALSAURUS=(110, 127, 128) AVOCADO=(86, 130,3) AZURE=(0, 127, 255) AZURE_MIST=(240, 255, 255) BABY_BLUE=(137, 207, 240) BABY_BLUE_EYES=(161, 202, 241) BABY_PINK=(244, 194, 194) BABY_POWDER=(254, 254, 250) BAKER_MILLER_PINK=(255, 145, 175) BALL_BLUE=(33, 171, 205)
3.3. API Documentation 41 Arcade Documentation, Release 1.1.0
BANANA_MANIA=(250, 231, 181) BANANA_YELLOW=(255, 225, 53) BANGLADESH_GREEN=(0, 106, 78) BARBIE_PINK=(224, 33, 138) BARN_RED=(124, 10,2) BATTLESHIP_GREY=(132, 132, 130) BAZAAR=(152, 119, 123) BEAU_BLUE=(188, 212, 230) BRIGHT_LILAC=(216, 145, 239) BEAVER=(159, 129, 112) BEIGE=(245, 245, 220) BISQUE=(255, 228, 196) BISTRE=(61, 43, 31) BISTRE_BROWN=(150, 113, 23) BITTER_LEMON=(202, 224, 13) BITTER_LIME=(100, 140, 17) BITTERSWEET=(254, 111, 94) BITTERSWEET_SHIMMER=(191, 79, 81) BLACK=(0,0,0) BLACK_BEAN=(61, 12,2) BLACK_LEATHER_JACKET=(37, 53, 41) BLACK_OLIVE=(59, 60, 54) BLANCHED_ALMOND=(255, 235, 205) BLAST_OFF_BRONZE=(165, 113, 100) BLEU_DE_FRANCE=(49, 140, 231) BLIZZARD_BLUE=(172, 229, 238) BLOND=(250, 240, 190) BLUE=(0,0, 255) BLUE_BELL=(162, 162, 208) BLUE_GRAY=(102, 153, 204) BLUE_GREEN=(13, 152, 186) BLUE_SAPPHIRE=(18, 97, 128) BLUE_VIOLET=(138, 43, 226) BLUE_YONDER=(80, 114, 167) BLUEBERRY=(79, 134, 247) BLUEBONNET=(28, 28, 240) BLUSH=(222, 93, 131) BOLE=(121, 68, 59) BONDI_BLUE=(0, 149, 182) BONE=(227, 218, 201) BOSTON_UNIVERSITY_RED=(204,0,0) BOTTLE_GREEN=(0, 106, 78) BOYSENBERRY=(135, 50, 96) BRANDEIS_BLUE=(0, 112, 255) BRASS=(181, 166, 66) BRICK_RED=(203, 65, 84) BRIGHT_CERULEAN=(29, 172, 214) BRIGHT_GREEN=(102, 255,0) BRIGHT_LAVENDER=(191, 148, 228) BRIGHT_MAROON=(195, 33, 72) BRIGHT_NAVY_BLUE=(25, 116, 210) BRIGHT_PINK=(255,0, 127) BRIGHT_TURQUOISE=(8, 232, 222) BRIGHT_UBE=(209, 159, 232) BRILLIANT_LAVENDER=(244, 187, 255) BRILLIANT_ROSE=(255, 85, 163) BRINK_PINK=(251, 96, 127) BRITISH_RACING_GREEN=(0, 66, 37)
42 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
BRONZE=(205, 127, 50) BRONZE_YELLOW=(115, 112,0) BROWN=(165, 42, 42) BROWN_NOSE=(107, 68, 35) BRUNSWICK_GREEN=(27, 77, 62) BUBBLE_GUM=(255, 193, 204) BUBBLES=(231, 254, 255) BUD_GREEN=(123, 182, 97) BUFF=(240, 220, 130) BULGARIAN_ROSE=(72,6,7) BURGUNDY=(128,0, 32) BURLYWOOD=(222, 184, 135) BURNT_ORANGE=(204, 85,0) BURNT_SIENNA=(233, 116, 81) BURNT_UMBER=(138, 51, 36) BYZANTINE=(189, 51, 164) BYZANTIUM=(112, 41, 99) CADET=(83, 104, 114) CADET_BLUE=(95, 158, 160) CADET_GREY=(145, 163, 176) CADMIUM_GREEN=(0, 107, 60) CADMIUM_ORANGE=(237, 135, 45) CADMIUM_RED=(227,0, 34) CADMIUM_YELLOW=(255, 246,0) CAL_POLY_GREEN=(30, 77, 43) CAMBRIDGE_BLUE=(163, 193, 173) CAMEL=(193, 154, 107) CAMEO_PINK=(239, 187, 204) CAMOUFLAGE_GREEN=(120, 134, 107) CANARY_YELLOW=(255, 239,0) CANDY_APPLE_RED=(255,8,0) CANDY_PINK=(228, 113, 122) CAPRI=(0, 191, 255) CAPUT_MORTUUM=(89, 39, 32) CARDINAL=(196, 30, 58) CARIBBEAN_GREEN=(0, 204, 153) CARMINE=(150,0, 24) CARMINE_PINK=(235, 76, 66) CARMINE_RED=(255,0, 56) CARNATION_PINK=(255, 166, 201) CARNELIAN=(179, 27, 27) CAROLINA_BLUE=(153, 186, 221) CARROT_ORANGE=(237, 145, 33) CASTLETON_GREEN=(0, 86, 63) CATALINA_BLUE=(6, 42, 120) CATAWBA=(112, 54, 66) CEDAR_CHEST=(201, 90, 73) CEIL=(146, 161, 207) CELADON=(172, 225, 175) CELADON_BLUE=(0, 123, 167) CELADON_GREEN=(47, 132, 124) CELESTE=(178, 255, 255) CELESTIAL_BLUE=(73, 151, 208) CERISE=(222, 49, 99) CERISE_PINK=(236, 59, 131) CERULEAN=(0, 123, 167) CERULEAN_BLUE=(42, 82, 190) CERULEAN_FROST=(109, 155, 195)
3.3. API Documentation 43 Arcade Documentation, Release 1.1.0
CG_BLUE=(0, 122, 165) CG_RED=(224, 60, 49) CHAMOISEE=(160, 120, 90) CHAMPAGNE=(247, 231, 206) CHARCOAL=(54, 69, 79) CHARLESTON_GREEN=(35, 43, 43) CHARM_PINK=(230, 143, 172) CHARTREUSE=(127, 255,0) CHERRY=(222, 49, 99) CHERRY_BLOSSOM_PINK=(255, 183, 197) CHESTNUT=(149, 69, 53) CHINA_PINK=(222, 111, 161) CHINA_ROSE=(168, 81, 110) CHINESE_RED=(170, 56, 30) CHINESE_VIOLET=(133, 96, 136) CHOCOLATE=(210, 105, 30) CHROME_YELLOW=(255, 167,0) CINEREOUS=(152, 129, 123) CINNABAR=(227, 66, 52) CINNAMON=(210, 105, 30) CITRINE=(228, 208, 10) CITRON=(159, 169, 31) CLARET=(127, 23, 52) CLASSIC_ROSE=(251, 204, 231) COAL=(124, 185, 232) COBALT=(0, 71, 171) COCOA_BROWN=(210, 105, 30) COCONUT=(150, 90, 62) COFFEE=(111, 78, 55) COLUMBIA_BLUE=(155, 221, 255) CONGO_PINK=(248, 131, 121) COOL_BLACK=(0, 46, 99) COOL_GREY=(140, 146, 172) COPPER=(184, 115, 51) COPPER_PENNY=(173, 111, 105) COPPER_RED=(203, 109, 81) COPPER_ROSE=(153, 102, 102) COQUELICOT=(255, 56,0) CORAL=(255, 127, 80) CORAL_PINK=(248, 131, 121) CORAL_RED=(255, 64, 64) CORDOVAN=(137, 63, 69) CORN=(251, 236, 93) CORNELL_RED=(179, 27, 27) CORNFLOWER_BLUE=(100, 149, 237) CORNSILK=(255, 248, 220) COSMIC_LATTE=(255, 248, 231) COTTON_CANDY=(255, 188, 217) CREAM=(255, 253, 208) CRIMSON=(220, 20, 60) CRIMSON_GLORY=(190,0, 50) CYAN=(0, 255, 255) CYBER_GRAPE=(88, 66, 124) CYBER_YELLOW=(255, 211,0) DAFFODIL=(255, 255, 49) DANDELION=(240, 225, 48) DARK_BLUE=(0,0, 139) DARK_BLUE_GRAY=(102, 102, 153)
44 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
DARK_BROWN=(101, 67, 33) DARK_BYZANTIUM=(93, 57, 84) DARK_CANDY_APPLE_RED=(164,0,0) DARK_CERULEAN=(8, 69, 126) DARK_CHESTNUT=(152, 105, 96) DARK_CORAL=(205, 91, 69) DARK_CYAN=(0, 139, 139) DARK_ELECTRIC_BLUE=(83, 104, 120) DARK_GOLDENROD=(184, 134, 11) DARK_GRAY=(169, 169, 169) DARK_GREEN=(1, 50, 32) DARK_IMPERIAL_BLUE=(0, 65, 106) DARK_JUNGLE_GREEN=(26, 36, 33) DARK_KHAKI=(189, 183, 107) DARK_LAVA=(72, 60, 50) DARK_LAVENDER=(115, 79, 150) DARK_LIVER=(83, 75, 79) DARK_MAGENTA=(139,0, 139) DARK_MIDNIGHT_BLUE=(0, 51, 102) DARK_MOSS_GREEN=(74, 93, 35) DARK_OLIVE_GREEN=(85, 107, 47) DARK_ORANGE=(255, 140,0) DARK_ORCHID=(153, 50, 204) DARK_PASTEL_BLUE=(119, 158, 203) DARK_PASTEL_GREEN=(3, 192, 60) DARK_PASTEL_PURPLE=(150, 111, 214) DARK_PASTEL_RED=(194, 59, 34) DARK_PINK=(231, 84, 128) DARK_POWDER_BLUE=(0, 51, 153) DARK_PUCE=(79, 58, 60) DARK_RASPBERRY=(135, 38, 87) DARK_RED=(139,0,0) DARK_SALMON=(233, 150, 122) DARK_SCARLET=(86,3, 25) DARK_SEA_GREEN=(143, 188, 143) DARK_SIENNA=(60, 20, 20) DARK_SKY_BLUE=(140, 190, 214) DARK_SLATE_BLUE=(72, 61, 139) DARK_SLATE_GRAY=(47, 79, 79) DARK_SPRING_GREEN=(23, 114, 69) DARK_TAN=(145, 129, 81) DARK_TANGERINE=(255, 168, 18) DARK_TAUPE=(72, 60, 50) DARK_TERRA_COTTA=(204, 78, 92) DARK_TURQUOISE=(0, 206, 209) DARK_VANILLA=(209, 190, 168) DARK_VIOLET=(148,0, 211) DARK_YELLOW=(155, 135, 12) DARTMOUTH_GREEN=(0, 112, 60) DAVY_GREY=(85, 85, 85) DEBIAN_RED=(215, 10, 83) DEEP_CARMINE=(169, 32, 62) DEEP_CARMINE_PINK=(239, 48, 56) DEEP_CARROT_ORANGE=(233, 105, 44) DEEP_CERISE=(218, 50, 135) DEEP_CHAMPAGNE=(250, 214, 165) DEEP_CHESTNUT=(185, 78, 72) DEEP_COFFEE=(112, 66, 65)
3.3. API Documentation 45 Arcade Documentation, Release 1.1.0
DEEP_FUCHSIA=(193, 84, 193) DEEP_JUNGLE_GREEN=(0, 75, 73) DEEP_LEMON=(245, 199, 26) DEEP_LILAC=(153, 85, 187) DEEP_MAGENTA=(204,0, 204) DEEP_MAUVE=(212, 115, 212) DEEP_MOSS_GREEN=(53, 94, 59) DEEP_PEACH=(255, 203, 164) DEEP_PINK=(255, 20, 147) DEEP_PUCE=(169, 92, 104) DEEP_RUBY=(132, 63, 91) DEEP_SAFFRON=(255, 153, 51) DEEP_SKY_BLUE=(0, 191, 255) DEEP_SPACE_SPARKLE=(74, 100, 108) DEEP_TAUPE=(126, 94, 96) DEEP_TUSCAN_RED=(102, 66, 77) DEER=(186, 135, 89) DENIM=(21, 96, 189) DESERT=(193, 154, 107) DESERT_SAND=(237, 201, 175) DESIRE=(234, 60, 83) DIAMOND=(185, 242, 255) DIM_GRAY=(105, 105, 105) DIRT=(155, 118, 83) DODGER_BLUE=(30, 144, 255) DOGWOOD_ROSE=(215, 24, 104) DOLLAR_BILL=(133, 187, 101) DONKEY_BROWN=(102, 76, 40) DRAB=(150, 113, 23) DUKE_BLUE=(0,0, 156) DUST_STORM=(229, 204, 201) DUTCH_WHITE=(239, 223, 187) EARTH_YELLOW=(225, 169, 95) EBONY=(85, 93, 80) ECRU=(194, 178, 128) EERIE_BLACK=(27, 27, 27) EGGPLANT=(97, 64, 81) EGGSHELL=(240, 234, 214) EGYPTIAN_BLUE=(16, 52, 166) ELECTRIC_BLUE=(125, 249, 255) ELECTRIC_CRIMSON=(255,0, 63) ELECTRIC_CYAN=(0, 255, 255) ELECTRIC_GREEN=(0, 255,0) ELECTRIC_INDIGO=(111,0, 255) ELECTRIC_LAVENDER=(244, 187, 255) ELECTRIC_LIME=(204, 255,0) ELECTRIC_PURPLE=(191,0, 255) ELECTRIC_ULTRAMARINE=(63,0, 255) ELECTRIC_VIOLET=(143,0, 255) ELECTRIC_YELLOW=(255, 255,0) EMERALD=(80, 200, 120) EMINENCE=(108, 48, 130) ENGLISH_GREEN=(27, 77, 62) ENGLISH_LAVENDER=(180, 131, 149) ENGLISH_RED=(171, 75, 82) ENGLISH_VIOLET=(86, 60, 92) ETON_BLUE=(150, 200, 162) EUCALYPTUS=(68, 215, 168)
46 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
FALLOW=(193, 154, 107) FALU_RED=(128, 24, 24) FANDANGO=(181, 51, 137) FANDANGO_PINK=(222, 82, 133) FASHION_FUCHSIA=(244,0, 161) FAWN=(229, 170, 112) FELDGRAU=(77, 93, 83) FELDSPAR=(253, 213, 177) FERN_GREEN=(79, 121, 66) FERRARI_RED=(255, 40,0) FIELD_DRAB=(108, 84, 30) FIREBRICK=(178, 34, 34) FIRE_ENGINE_RED=(206, 32, 41) FLAME=(226, 88, 34) FLAMINGO_PINK=(252, 142, 172) FLATTERY=(107, 68, 35) FLAVESCENT=(247, 233, 142) FLAX=(238, 220, 130) FLIRT=(162,0, 109) FLORAL_WHITE=(255, 250, 240) FLUORESCENT_ORANGE=(255, 191,0) FLUORESCENT_PINK=(255, 20, 147) FLUORESCENT_YELLOW=(204, 255,0) FOLLY=(255,0, 79) FOREST_GREEN=(34, 139, 34) FRENCH_BEIGE=(166, 123, 91) FRENCH_BISTRE=(133, 109, 77) FRENCH_BLUE=(0, 114, 187) FRENCH_FUCHSIA=(253, 63, 146) FRENCH_LILAC=(134, 96, 142) FRENCH_LIME=(158, 253, 56) FRENCH_MAUVE=(212, 115, 212) FRENCH_PINK=(253, 108, 158) FRENCH_PUCE=(78, 22,9) FRENCH_RASPBERRY=(199, 44, 72) FRENCH_ROSE=(246, 74, 138) FRENCH_SKY_BLUE=(119, 181, 254) FRENCH_WINE=(172, 30, 68) FRESH_AIR=(166, 231, 255) FUCHSIA=(255,0, 255) FUCHSIA_PINK=(255, 119, 255) FUCHSIA_PURPLE=(204, 57, 123) FUCHSIA_ROSE=(199, 67, 117) FULVOUS=(228, 132,0) FUZZY_WUZZY=(204, 102, 102) GAINSBORO=(220, 220, 220) GAMBOGE=(228, 155, 15) GENERIC_VIRIDIAN=(0, 127, 102) GHOST_WHITE=(248, 248, 255) GIANTS_ORANGE=(254, 90, 29) GINGER=(176, 101,0) GLAUCOUS=(96, 130, 182) GLITTER=(230, 232, 250) GO_GREEN=(0, 171, 102) GOLD=(255, 215,0) GOLD_FUSION=(133, 117, 78) GOLDEN_BROWN=(153, 101, 21) GOLDEN_POPPY=(252, 194,0)
3.3. API Documentation 47 Arcade Documentation, Release 1.1.0
GOLDEN_YELLOW=(255, 223,0) GOLDENROD=(218, 165, 32) GRANNY_SMITH_APPLE=(168, 228, 160) GRAPE=(111, 45, 168) GRAY=(128, 128, 128) GRAY_ASPARAGUS=(70, 89, 69) GRAY_BLUE=(140, 146, 172) GREEN=(0, 255,0) GREEN_YELLOW=(173, 255, 47) GRULLO=(169, 154, 134) GUPPIE_GREEN=(0, 255, 127) HAN_BLUE=(68, 108, 207) HAN_PURPLE=(82, 24, 250) HANSA_YELLOW=(233, 214, 107) HARLEQUIN=(63, 255,0) HARVARD_CRIMSON=(201,0, 22) HARVEST_GOLD=(218, 145,0) HEART_GOLD=(128, 128,0) HELIOTROPE=(223, 115, 255) HELIOTROPE_GRAY=(170, 152, 169) HOLLYWOOD_CERISE=(244,0, 161) HONEYDEW=(240, 255, 240) HONOLULU_BLUE=(0, 109, 176) HOOKER_GREEN=(73, 121, 107) HOT_MAGENTA=(255, 29, 206) HOT_PINK=(255, 105, 180) HUNTER_GREEN=(53, 94, 59) ICEBERG=(113, 166, 210) ICTERINE=(252, 247, 94) ILLUMINATING_EMERALD=(49, 145, 119) IMPERIAL=(96, 47, 107) IMPERIAL_BLUE=(0, 35, 149) IMPERIAL_PURPLE=(102,2, 60) IMPERIAL_RED=(237, 41, 57) INCHWORM=(178, 236, 93) INDEPENDENCE=(76, 81, 109) INDIA_GREEN=(19, 136,8) INDIAN_RED=(205, 92, 92) INDIAN_YELLOW=(227, 168, 87) INDIGO=(75,0, 130) INTERNATIONAL_KLEIN_BLUE=(0, 47, 167) INTERNATIONAL_ORANGE=(255, 79,0) IRIS=(90, 79, 207) IRRESISTIBLE=(179, 68, 108) ISABELLINE=(244, 240, 236) ISLAMIC_GREEN=(0, 144,0) ITALIAN_SKY_BLUE=(178, 255, 255) IVORY=(255, 255, 240) JADE=(0, 168, 107) JAPANESE_CARMINE=(157, 41, 51) JAPANESE_INDIGO=(38, 67, 72) JAPANESE_VIOLET=(91, 50, 86) JASMINE=(248, 222, 126) JASPER=(215, 59, 62) JAZZBERRY_JAM=(165, 11, 94) JELLY_BEAN=(218, 97, 78) JET=(52, 52, 52) JONQUIL=(244, 202, 22)
48 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
JORDY_BLUE=(138, 185, 241) JUNE_BUD=(189, 218, 87) JUNGLE_GREEN=(41, 171, 135) KELLY_GREEN=(76, 187, 23) KENYAN_COPPER=(124, 28,5) KEPPEL=(58, 176, 158) KHAKI=(195, 176, 145) KOBE=(136, 45, 23) KOBI=(231, 159, 196) KOMBU_GREEN=(53, 66, 48) KU_CRIMSON=(232,0, 13) LA_SALLE_GREEN=(8, 120, 48) LANGUID_LAVENDER=(214, 202, 221) LAPIS_LAZULI=(38, 97, 156) LASER_LEMON=(255, 255, 102) LAUREL_GREEN=(169, 186, 157) LAVA=(207, 16, 32) LAVENDER=(230, 230, 250) LAVENDER_BLUE=(204, 204, 255) LAVENDER_BLUSH=(255, 240, 245) LAVENDER_GRAY=(196, 195, 208) LAVENDER_INDIGO=(148, 87, 235) LAVENDER_MAGENTA=(238, 130, 238) LAVENDER_MIST=(230, 230, 250) LAVENDER_PINK=(251, 174, 210) LAVENDER_PURPLE=(150, 123, 182) LAVENDER_ROSE=(251, 160, 227) LAWN_GREEN=(124, 252,0) LEMON=(255, 247,0) LEMON_CHIFFON=(255, 250, 205) LEMON_CURRY=(204, 160, 29) LEMON_GLACIER=(253, 255,0) LEMON_LIME=(227, 255,0) LEMON_MERINGUE=(246, 234, 190) LEMON_YELLOW=(255, 244, 79) LIBERTY=(84, 90, 167) LICORICE=(26, 17, 16) LIGHT_APRICOT=(253, 213, 177) LIGHT_BLUE=(173, 216, 230) LIGHT_BROWN=(181, 101, 29) LIGHT_CARMINE_PINK=(230, 103, 113) LIGHT_CORAL=(240, 128, 128) LIGHT_CORNFLOWER_BLUE=(147, 204, 234) LIGHT_CRIMSON=(245, 105, 145) LIGHT_CYAN=(224, 255, 255) LIGHT_DEEP_PINK=(255, 92, 205) LIGHT_FUCHSIA_PINK=(249, 132, 239) LIGHT_GOLDENROD_YELLOW=(250, 250, 210) LIGHT_GRAY=(211, 211, 211) LIGHT_GREEN=(144, 238, 144) LIGHT_HOT_PINK=(255, 179, 222) LIGHT_KHAKI=(240, 230, 140) LIGHT_MEDIUM_ORCHID=(211, 155, 203) LIGHT_MOSS_GREEN=(173, 223, 173) LIGHT_ORCHID=(230, 168, 215) LIGHT_PASTEL_PURPLE=(177, 156, 217) LIGHT_PINK=(255, 182, 193) LIGHT_RED_OCHRE=(233, 116, 81)
3.3. API Documentation 49 Arcade Documentation, Release 1.1.0
LIGHT_SALMON=(255, 160, 122) LIGHT_SALMON_PINK=(255, 153, 153) LIGHT_SEA_GREEN=(32, 178, 170) LIGHT_SKY_BLUE=(135, 206, 250) LIGHT_SLATE_GRAY=(119, 136, 153) LIGHT_STEEL_BLUE=(176, 196, 222) LIGHT_TAUPE=(179, 139, 109) LIGHT_THULIAN_PINK=(230, 143, 172) LIGHT_YELLOW=(255, 255, 224) LILAC=(200, 162, 200) LIME=(191, 255,0) LIME_GREEN=(50, 205, 50) LIMERICK=(157, 194,9) LINCOLN_GREEN=(25, 89,5) LINEN=(250, 240, 230) LION=(193, 154, 107) LISERAN_PURPLE=(222, 111, 161) LITTLE_BOY_BLUE=(108, 160, 220) LIVER=(103, 76, 71) LIVER_CHESTNUT=(152, 116, 86) LIVID=(102, 153, 204) LUMBER=(255, 228, 205) LUST=(230, 32, 32) MAGENTA=(255,0, 255) MAGENTA_HAZE=(159, 69, 118) MAGIC_MINT=(170, 240, 209) MAGNOLIA=(248, 244, 255) MAHOGANY=(192, 64,0) MAIZE=(251, 236, 93) MAJORELLE_BLUE=(96, 80, 220) MALACHITE=(11, 218, 81) MANATEE=(151, 154, 170) MANGO_TANGO=(255, 130, 67) MANTIS=(116, 195, 101) MARDI_GRAS=(136,0, 133) MAROON=(128,0,0) MAUVE=(224, 176, 255) MAUVE_TAUPE=(145, 95, 109) MAUVELOUS=(239, 152, 170) MAYA_BLUE=(115, 194, 251) MEAT_BROWN=(229, 183, 59) MEDIUM_AQUAMARINE=(102, 221, 170) MEDIUM_BLUE=(0,0, 205) MEDIUM_CANDY_APPLE_RED=(226,6, 44) MEDIUM_CARMINE=(175, 64, 53) MEDIUM_CHAMPAGNE=(243, 229, 171) MEDIUM_ELECTRIC_BLUE=(3, 80, 150) MEDIUM_JUNGLE_GREEN=(28, 53, 45) MEDIUM_LAVENDER_MAGENTA=(221, 160, 221) MEDIUM_ORCHID=(186, 85, 211) MEDIUM_PERSIAN_BLUE=(0, 103, 165) MEDIUM_PURPLE=(147, 112, 219) MEDIUM_RED_VIOLET=(187, 51, 133) MEDIUM_RUBY=(170, 64, 105) MEDIUM_SEA_GREEN=(60, 179, 113) MEDIUM_SLATE_BLUE=(123, 104, 238) MEDIUM_SPRING_BUD=(201, 220, 135) MEDIUM_SPRING_GREEN=(0, 250, 154)
50 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
MEDIUM_SKY_BLUE=(128, 218, 235) MEDIUM_TAUPE=(103, 76, 71) MEDIUM_TURQUOISE=(72, 209, 204) MEDIUM_TUSCAN_RED=(121, 68, 59) MEDIUM_VERMILION=(217, 96, 59) MEDIUM_VIOLET_RED=(199, 21, 133) MELLOW_APRICOT=(248, 184, 120) MELLOW_YELLOW=(248, 222, 126) MELON=(253, 188, 180) METALLIC_SEAWEED=(10, 126, 140) METALLIC_SUNBURST=(156, 124, 56) MEXICAN_PINK=(228,0, 124) MIDNIGHT_BLUE=(25, 25, 112) MIDNIGHT_GREEN=(0, 73, 83) MIKADO_YELLOW=(255, 196, 12) MINDARO=(227, 249, 136) MINT=(62, 180, 137) MINT_CREAM=(245, 255, 250) MINT_GREEN=(152, 255, 152) MISTY_ROSE=(255, 228, 225) MOCCASIN=(250, 235, 215) MODE_BEIGE=(150, 113, 23) MOONSTONE_BLUE=(115, 169, 194) MORDANT_RED_19=(174, 12,0) MOSS_GREEN=(138, 154, 91) MOUNTAIN_MEADOW=(48, 186, 143) MOUNTBATTEN_PINK=(153, 122, 141) MSU_GREEN=(24, 69, 59) MUGHAL_GREEN=(48, 96, 48) MULBERRY=(197, 75, 140) MUSTARD=(255, 219, 88) MYRTLE_GREEN=(49, 120, 115) NADESHIKO_PINK=(246, 173, 198) NAPIER_GREEN=(42, 128,0) NAPLES_YELLOW=(250, 218, 94) NAVAJO_WHITE=(255, 222, 173) NAVY_BLUE=(0,0, 128) NAVY_PURPLE=(148, 87, 235) NEON_CARROT=(255, 163, 67) NEON_FUCHSIA=(254, 65, 100) NEON_GREEN=(57, 255, 20) NEW_CAR=(33, 79, 198) NEW_YORK_PINK=(215, 131, 127) NON_PHOTO_BLUE=(164, 221, 237) NYANZA=(233, 255, 219) OCEAN_BOAT_BLUE=(0, 119, 190) OCHRE=(204, 119, 34) OFFICE_GREEN=(0, 128,0) OLD_BURGUNDY=(67, 48, 46) OLD_GOLD=(207, 181, 59) OLD_HELIOTROPE=(86, 60, 92) OLD_LACE=(253, 245, 230) OLD_LAVENDER=(121, 104, 120) OLD_MAUVE=(103, 49, 71) OLD_MOSS_GREEN=(134, 126, 54) OLD_ROSE=(192, 128, 129) OLD_SILVER=(132, 132, 130) OLIVE=(128, 128,0)
3.3. API Documentation 51 Arcade Documentation, Release 1.1.0
OLIVE_DRAB=(107, 142, 35) OLIVINE=(154, 185, 115) ONYX=(53, 56, 57) OPERA_MAUVE=(183, 132, 167) ORANGE=(255, 165,0) ORANGE_PEEL=(255, 159,0) ORANGE_RED=(255, 69,0) ORCHID=(218, 112, 214) ORCHID_PINK=(242, 141, 205) ORIOLES_ORANGE=(251, 79, 20) OTTER_BROWN=(101, 67, 33) OUTER_SPACE=(65, 74, 76) OUTRAGEOUS_ORANGE=(255, 110, 74) OXFORD_BLUE=(0, 33, 71) OU_CRIMSON_RED=(153,0,0) PAKISTAN_GREEN=(0, 102,0) PALATINATE_BLUE=(39, 59, 226) PALATINATE_PURPLE=(104, 40, 96) PALE_AQUA=(188, 212, 230) PALE_BLUE=(175, 238, 238) PALE_BROWN=(152, 118, 84) PALE_CARMINE=(175, 64, 53) PALE_CERULEAN=(155, 196, 226) PALE_CHESTNUT=(221, 173, 175) PALE_COPPER=(218, 138, 103) PALE_CORNFLOWER_BLUE=(171, 205, 239) PALE_GOLD=(230, 190, 138) PALE_GOLDENROD=(238, 232, 170) PALE_GREEN=(152, 251, 152) PALE_LAVENDER=(220, 208, 255) PALE_MAGENTA=(249, 132, 229) PALE_PINK=(250, 218, 221) PALE_PLUM=(221, 160, 221) PALE_RED_VIOLET=(219, 112, 147) PALE_ROBIN_EGG_BLUE=(150, 222, 209) PALE_SILVER=(201, 192, 187) PALE_SPRING_BUD=(236, 235, 189) PALE_TAUPE=(188, 152, 126) PALE_TURQUOISE=(175, 238, 238) PALE_VIOLET_RED=(219, 112, 147) PANSY_PURPLE=(120, 24, 74) PAOLO_VERONESE_GREEN=(0, 155, 125) PAPAYA_WHIP=(255, 239, 213) PARADISE_PINK=(230, 62, 98) PARIS_GREEN=(80, 200, 120) PASTEL_BLUE=(174, 198, 207) PASTEL_BROWN=(131, 105, 83) PASTEL_GRAY=(207, 207, 196) PASTEL_GREEN=(119, 221, 119) PASTEL_MAGENTA=(244, 154, 194) PASTEL_ORANGE=(255, 179, 71) PASTEL_PINK=(222, 165, 164) PASTEL_PURPLE=(179, 158, 181) PASTEL_RED=(255, 105, 97) PASTEL_VIOLET=(203, 153, 201) PASTEL_YELLOW=(253, 253, 150) PATRIARCH=(128,0, 128) PAYNE_GREY=(83, 104, 120)
52 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
PEACH=(255, 229, 180) PEACH_ORANGE=(255, 204, 153) PEACH_PUFF=(255, 218, 185) PEACH_YELLOW=(250, 223, 173) PEAR=(209, 226, 49) PEARL=(234, 224, 200) PEARL_AQUA=(136, 216, 192) PEARLY_PURPLE=(183, 104, 162) PERIDOT=(230, 226,0) PERIWINKLE=(204, 204, 255) PERSIAN_BLUE=(28, 57, 187) PERSIAN_GREEN=(0, 166, 147) PERSIAN_INDIGO=(50, 18, 122) PERSIAN_ORANGE=(217, 144, 88) PERSIAN_PINK=(247, 127, 190) PERSIAN_PLUM=(112, 28, 28) PERSIAN_RED=(204, 51, 51) PERSIAN_ROSE=(254, 40, 162) PERSIMMON=(236, 88,0) PERU=(205, 133, 63) PHLOX=(223,0, 255) PHTHALO_BLUE=(0, 15, 137) PHTHALO_GREEN=(18, 53, 36) PICTON_BLUE=(69, 177, 232) PICTORIAL_CARMINE=(195, 11, 78) PIGGY_PINK=(253, 221, 230) PINE_GREEN=(1, 121, 111) PINK=(255, 192, 203) PINK_LACE=(255, 221, 244) PINK_LAVENDER=(216, 178, 209) PINK_PEARL=(231, 172, 207) PINK_SHERBET=(247, 143, 167) PISTACHIO=(147, 197, 114) PLATINUM=(229, 228, 226) PLUM=(221, 160, 221) POMP_AND_POWER=(134, 96, 142) POPSTAR=(190, 79, 98) PORTLAND_ORANGE=(255, 90, 54) POWDER_BLUE=(176, 224, 230) PRINCETON_ORANGE=(255, 143,0) PRUNE=(112, 28, 28) PRUSSIAN_BLUE=(0, 49, 83) PSYCHEDELIC_PURPLE=(223,0, 255) PUCE=(204, 136, 153) PUCE_RED=(114, 47, 55) PULLMAN_BROWN=(100, 65, 23) PUMPKIN=(255, 117, 24) PURPLE=(128,0, 128) PURPLE_HEART=(105, 53, 156) PURPLE_MOUNTAIN_MAJESTY=(150, 120, 182) PURPLE_NAVY=(78, 81, 128) PURPLE_PIZZAZZ=(254, 78, 218) PURPLE_TAUPE=(80, 64, 77) PURPUREUS=(154, 78, 174) QUARTZ=(81, 72, 79) QUEEN_BLUE=(67, 107, 149) QUEEN_PINK=(232, 204, 215) QUINACRIDONE_MAGENTA=(142, 58, 89)
3.3. API Documentation 53 Arcade Documentation, Release 1.1.0
RACKLEY=(93, 138, 168) RADICAL_RED=(255, 53, 94) RAJAH=(251, 171, 96) RASPBERRY=(227, 11, 93) RASPBERRY_GLACE=(145, 95, 109) RASPBERRY_PINK=(226, 80, 152) RASPBERRY_ROSE=(179, 68, 108) RAW_UMBER=(130, 102, 68) RAZZLE_DAZZLE_ROSE=(255, 51, 204) RAZZMATAZZ=(227, 37, 107) RAZZMIC_BERRY=(141, 78, 133) RED=(255,0,0) RED_BROWN=(165, 42, 42) RED_DEVIL=(134,1, 17) RED_ORANGE=(255, 83, 73) RED_PURPLE=(228,0, 120) RED_VIOLET=(199, 21, 133) REDWOOD=(164, 90, 82) REGALIA=(82, 45, 128) RESOLUTION_BLUE=(0, 35, 135) RHYTHM=(119, 118, 150) RICH_BLACK=(0, 64, 64) RICH_BRILLIANT_LAVENDER=(241, 167, 254) RICH_CARMINE=(215,0, 64) RICH_ELECTRIC_BLUE=(8, 146, 208) RICH_LAVENDER=(167, 107, 207) RICH_LILAC=(182, 102, 210) RICH_MAROON=(176, 48, 96) RIFLE_GREEN=(68, 76, 56) ROAST_COFFEE=(112, 66, 65) ROBIN_EGG_BLUE=(0, 204, 204) ROCKET_METALLIC=(138, 127, 128) ROMAN_SILVER=(131, 137, 150) ROSE=(255,0, 127) ROSE_BONBON=(249, 66, 158) ROSE_EBONY=(103, 72, 70) ROSE_GOLD=(183, 110, 121) ROSE_MADDER=(227, 38, 54) ROSE_PINK=(255, 102, 204) ROSE_QUARTZ=(170, 152, 169) ROSE_RED=(194, 30, 86) ROSE_TAUPE=(144, 93, 93) ROSE_VALE=(171, 78, 82) ROSEWOOD=(101,0, 11) ROSSO_CORSA=(212,0,0) ROSY_BROWN=(188, 143, 143) ROYAL_AZURE=(0, 56, 168) ROYAL_BLUE=(65, 105, 225) ROYAL_FUCHSIA=(202, 44, 146) ROYAL_PURPLE=(120, 81, 169) ROYAL_YELLOW=(250, 218, 94) RUBER=(206, 70, 118) RUBINE_RED=(209,0, 86) RUBY=(224, 17, 95) RUBY_RED=(155, 17, 30) RUDDY=(255,0, 40) RUDDY_BROWN=(187, 101, 40) RUDDY_PINK=(225, 142, 150)
54 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
RUFOUS=(168, 28,7) RUSSET=(128, 70, 27) RUSSIAN_GREEN=(103, 146, 103) RUSSIAN_VIOLET=(50, 23, 77) RUST=(183, 65, 14) RUSTY_RED=(218, 44, 67) SACRAMENTO_STATE_GREEN=(0, 86, 63) SADDLE_BROWN=(139, 69, 19) SAFETY_ORANGE=(255, 103,0) SAFETY_YELLOW=(238, 210,2) SAFFRON=(244, 196, 48) SAGE=(188, 184, 138) ST_PATRICK_BLUE=(35, 41, 122) SALMON=(250, 128, 114) SALMON_PINK=(255, 145, 164) SAND=(194, 178, 128) SAND_DUNE=(150, 113, 23) SANDSTORM=(236, 213, 64) SANDY_BROWN=(244, 164, 96) SANDY_TAUPE=(150, 113, 23) SANGRIA=(146,0, 10) SAP_GREEN=(80, 125, 42) SAPPHIRE=(15, 82, 186) SAPPHIRE_BLUE=(0, 103, 165) SATIN_SHEEN_GOLD=(203, 161, 53) SCARLET=(255, 36,0) SCHAUSS_PINK=(255, 145, 175) SCHOOL_BUS_YELLOW=(255, 216,0) SCREAMIN_GREEN=(118, 255, 122) SEA_BLUE=(0, 105, 148) SEA_GREEN=(46, 255, 139) SEAL_BROWN=(50, 20, 20) SEASHELL=(255, 245, 238) SELECTIVE_YELLOW=(255, 186,0) SEPIA=(112, 66, 20) SHADOW=(138, 121, 93) SHADOW_BLUE=(119, 139, 165) SHAMPOO=(255, 207, 241) SHAMROCK_GREEN=(0, 158, 96) SHEEN_GREEN=(143, 212,0) SHIMMERING_BLUSH=(217, 134, 149) SHOCKING_PINK=(252, 15, 192) SIENNA=(136, 45, 23) SILVER=(192, 192, 192) SILVER_CHALICE=(172, 172, 172) SILVER_LAKE_BLUE=(93, 137, 186) SILVER_PINK=(196, 174, 173) SILVER_SAND=(191, 193, 194) SINOPIA=(203, 65, 11) SKOBELOFF=(0, 116, 116) SKY_BLUE=(135, 206, 235) SKY_MAGENTA=(207, 113, 175) SLATE_BLUE=(106, 90, 205) SLATE_GRAY=(112, 128, 144) SMALT=(0, 51, 153) SMITTEN=(200, 65, 134) SMOKE=(115, 130, 118) SMOKEY_TOPAZ=(147, 61, 65)
3.3. API Documentation 55 Arcade Documentation, Release 1.1.0
SMOKY_BLACK=(16, 12,8) SNOW=(255, 250, 250) SOAP=(206, 200, 239) SONIC_SILVER=(117, 117, 117) SPACE_CADET=(29, 41, 81) SPANISH_BISTRE=(128, 117, 90) SPANISH_CARMINE=(209,0, 71) SPANISH_CRIMSON=(229, 26, 76) SPANISH_BLUE=(0, 112, 184) SPANISH_GRAY=(152, 152, 152) SPANISH_GREEN=(0, 145, 80) SPANISH_ORANGE=(232, 97,0) SPANISH_PINK=(247, 191, 190) SPANISH_RED=(230,0, 38) SPANISH_SKY_BLUE=(0, 170, 228) SPANISH_VIOLET=(76, 40, 130) SPANISH_VIRIDIAN=(0, 127, 92) SPIRO_DISCO_BALL=(15, 192, 252) SPRING_BUD=(167, 252,0) SPRING_GREEN=(0, 255, 127) STAR_COMMAND_BLUE=(0, 123, 184) STEEL_BLUE=(70, 130, 180) STEEL_PINK=(204, 51, 102) STIL_DE_GRAIN_YELLOW=(250, 218, 94) STIZZA=(153,0,0) STORMCLOUD=(79, 102, 106) STRAW=(228, 217, 111) STRAWBERRY=(252, 90, 141) SUNGLOW=(255, 204, 51) SUNRAY=(227, 171, 87) SUNSET=(250, 214, 165) SUNSET_ORANGE=(253, 94, 83) SUPER_PINK=(207, 107, 169) TAN=(210, 180, 140) TANGELO=(249, 77,0) TANGERINE=(242, 133,0) TANGERINE_YELLOW=(255, 204,0) TANGO_PINK=(228, 113, 122) TAUPE=(72, 60, 50) TAUPE_GRAY=(139, 133, 137) TEA_GREEN=(208, 240, 192) TEA_ROSE=(244, 194, 194) TEAL=(0, 128, 128) TEAL_BLUE=(54, 117, 136) TEAL_DEER=(153, 230, 179) TEAL_GREEN=(0, 130, 127) TELEMAGENTA=(207, 52, 118) TERRA_COTTA=(226, 114, 91) THISTLE=(216, 191, 216) THULIAN_PINK=(222, 111, 161) TICKLE_ME_PINK=(252, 137, 172) TIFFANY_BLUE=(10, 186, 181) TIGERS_EYE=(224, 141, 60) TIMBERWOLF=(219, 215, 210) TITANIUM_YELLOW=(238, 230,0) TOMATO=(255, 99, 71) TOOLBOX=(116, 108, 192) TOPAZ=(255, 200, 124)
56 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
TRACTOR_RED=(253, 14, 53) TROLLEY_GREY=(128, 128, 128) TROPICAL_RAIN_FOREST=(0, 117, 94) TRUE_BLUE=(0, 115, 207) TUFTS_BLUE=(65, 125, 193) TULIP=(255, 135, 141) TUMBLEWEED=(222, 170, 136) TURKISH_ROSE=(181, 114, 129) TURQUOISE=(64, 224, 208) TURQUOISE_BLUE=(0, 255, 239) TURQUOISE_GREEN=(160, 214, 180) TUSCAN=(250, 214, 165) TUSCAN_BROWN=(111, 78, 55) TUSCAN_RED=(124, 72, 72) TUSCAN_TAN=(166, 123, 91) TUSCANY=(192, 153, 153) TWILIGHT_LAVENDER=(138, 73, 107) TYRIAN_PURPLE=(102,2, 60) UA_BLUE=(0, 51, 170) UA_RED=(217,0, 76) UBE=(136, 120, 195) UCLA_BLUE=(83, 104, 149) UCLA_GOLD=(255, 179,0) UFO_GREEN=(60, 208, 112) ULTRAMARINE=(18, 10, 143) ULTRAMARINE_BLUE=(65, 102, 245) ULTRA_PINK=(255, 111, 255) UMBER=(99, 81, 71) UNBLEACHED_SILK=(255, 221, 202) UNITED_NATIONS_BLUE=(91, 146, 229) UNIVERSITY_OF_CALIFORNIA_GOLD=(183, 135, 39) UNMELLOW_YELLOW=(255, 255, 102) UP_FOREST_GREEN=(1, 68, 33) UP_MAROON=(123, 17, 19) UPSDELL_RED=(174, 32, 41) UROBILIN=(225, 173, 33) USAFA_BLUE=(0, 79, 152) USC_CARDINAL=(153,0,0) USC_GOLD=(255, 204,0) UNIVERSITY_OF_TENNESSEE_ORANGE=(247, 127,0) UTAH_CRIMSON=(211,0, 63) VANILLA=(243, 229, 171) VANILLA_ICE=(243, 143, 169) VEGAS_GOLD=(197, 179, 88) VENETIAN_RED=(200,8, 21) VERDIGRIS=(67, 179, 174) VERMILION=(227, 66, 52) VERONICA=(160, 32, 240) VIOLET=(143,0, 255) VIOLET_BLUE=(50, 74, 178) VIOLET_RED=(247, 83, 148) VIRIDIAN=(64, 130, 109) VIRIDIAN_GREEN=(0, 150, 152) VIVID_AUBURN=(146, 39, 36) VIVID_BURGUNDY=(159, 29, 53) VIVID_CERISE=(218, 29, 129) VIVID_ORCHID=(204,0, 255) VIVID_SKY_BLUE=(0, 204, 255)
3.3. API Documentation 57 Arcade Documentation, Release 1.1.0
VIVID_TANGERINE=(255, 160, 137) VIVID_VIOLET=(159,0, 255) WARM_BLACK=(0, 66, 66) WATERSPOUT=(164, 244, 249) WENGE=(100, 84, 82) WHEAT=(245, 222, 179) WHITE=(255, 255, 255) WHITE_SMOKE=(245, 245, 245) WILD_BLUE_YONDER=(162, 173, 208) WILD_ORCHID=(212, 112, 162) WILD_STRAWBERRY=(255, 67, 164) WILD_WATERMELON=(252, 108, 133) WILLPOWER_ORANGE=(253, 88,0) WINDSOR_TAN=(167, 85,2) WINE=(114, 47, 55) WINE_DREGS=(103, 49, 71) WISTERIA=(201, 160, 220) WOOD_BROWN=(193, 154, 107) XANADU=(115, 134, 120) YALE_BLUE=(15, 77, 146) YANKEES_BLUE=(28, 40, 65) YELLOW=(255, 255,0) YELLOW_GREEN=(154, 205, 50) YELLOW_ORANGE=(255, 174, 66) YELLOW_ROSE=(255, 240,0) ZAFFRE=(0, 20, 168) ZINNWALDITE_BROWN=(44, 22,8)
How to Contribute
How to Contribute
We would love to have you contribute to the project! There are several ways that you can do so.
How to contribute without coding
• Community - Post your projects, code, screen-shots, and discuss the Arcade library on the Python Arcade SubReddit. • Try coding your own animations and games. Write down notes on anything that is difficult to implement or understand about the library. • Suggest improvements - Post bugs and enhancement requests at the Github Issue List.
How to contribute code
First, take some time to understand the project layout: • Directory Structure • How to Compile • How to Submit Changes Then you can improve these parts of the project:
58 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
• Document - Edit the reStructuredText and docstrings to make the Arcade documentation better. • Test - Improve the unit testing. • Code - Contribute bug fixes and enhancements to the code.
Directory Structure
Directory Description \arcade Source code for the arcade library. \arcade\color Submodule with predefined colors. \arcade\key Submodule with keyboard id codes. \build All built code from the compile script goes here. \dist Distributable Python wheels go here after the build script has run. \doc Arcade documentation. Note that API documentation is in docstrings along with the source. \doc\source Source rst files for the documentation. \doc\source\examplesAll the example code \doc\source\imagesImages used in the documentation. \doc\build\html After making the documentation, all the HTML code goes here. Look at this in a web browser to see what the documentation will look like. \tests Unit tests. Most unit tests are part of the docstrings. Also see How to Compile.
How to Compile
Windows
Prep your system by getting needed Python packages: pip install wheel sphinx coveralls sphinx_rtd_theme pyglet numpy Create your own fork of the repository, and then clone it on your computer. From the base directory, there are three batch files that can be run: • make - This compiles the source, installs the package on the local computer, compiles the documentation, and runs all the unit tests. • makedoc - This compiles the documentation. Resulting documentation will be in doc/build/html. • makefast - This compiles and installs the source code. It does not create the documentation or run any unit tests. Note: Placing test programs in the root of the project folder will pull from the source code in the arcade library, rather than the library installed in the Python interpreter. This is helpful because you can avoid the compile step. Just make sure not to check in your test code.
Linux
Create your own fork of the repository, and then clone it on your computer. Prep your system by downloading needed packages: sudo apt-get install python-dev sudo pip3 install wheel sphinx coveralls sphinx_rtd_theme pyglet numpy
3.4. How to Contribute 59 Arcade Documentation, Release 1.1.0
Then, from the terminal you can run any of the following scripts: • sudo make.sh - Compile, install, make documentation, and run unit tests. • sudo makefast.sh - Compile, install. • makedoc.sh - Make documentation.
How to Submit Changes
First, you should open up an issue or enhancement request on the Github Issue List. Next, create your own fork of the Arcade library. The Arcade library is at: https://github.com/pvcraven/arcade Follow the How to Compile on how to build the code. You can submit changes with a “pull request.” With a pull request you ask that another repository (in this case the Arcade library) “pull” your changes into the main code base. If you aren’t familiar with how to do pull requests, Stack Overflow discussion on pull requests is good. There are two Continuous Integration machines building changes to the code base. Windows builds are done on AppVeyor. Linux build testing is done on TravisCI.
More Information
Pygame Comparison
The Python Arcade Library has the same target audience as the well-known Pygame library. So how do they differ? Features that the Arcade Library has that Pygame does not: • Supports Python 3 type hinting. • Thick ellipses, arcs, and circles do not have a moiré pattern. • Ellipses, arcs, and other shapes can be easily rotated. • Supports installation via standard Python package manager, using ‘pip install’ • Uses standard coordinate system you learned about in math. (0, 0) is in the lower left, and not upper left. Y-coordinates are not reversed. • Has built-in physics engine for platformers. • Supports animated sprites. • API documentation for the commands is better. Many commands include unit tests right in the documentation. • Command names are consistent. For example, to add to a sprite list you use the add() method, like any other list in Python. Pygame uses append(). • Parameter and command names are clearer. For example, open_window instead of set_mode. • Less boiler-plate code than Pygame. • Basic drawing does not require knowledge on how to define functions or classes or how to do loops. • Encourages separation of logic and display code. Pygame tends to put both into the same game loop. • Runs on top of OpenGL and Pyglet, rather than the old SDL1 library.
60 Chapter 3. Contribute to the development: Arcade Documentation, Release 1.1.0
• With the use of sprite lists, uses the acceleration of the graphics card to improve performance. • Lots of Example Code. Features that Pygame has that the Arcade Library does not: • Python 2 support • Does not require OpenGL • Supports older hardware like cameras, cdroms, MIDI • Has better support for pixel manipulation in a memory buffer that isn’t displayed on screen.
Suggested Curriculum
The Arcade library is designed to support education. Get students hooked on programming. Then start teaching them new concepts, as students discover the need. Arcade’s theme: “Only advanced actions should require advanced knowledge.” What does this mean? For example, if a students want to create an image with drawing commands, they should not have to know about defining functions, classes, or using decorators, or any other advanced programming topic. Below is a rough list of common first-course items to teach, and the order they could be taught in.
Stage 1:
Draw
• Learn to call drawing commands and create your own drawings. • Learn to use variables to change your drawing. • Teach students about common error messages, and how to read and use them.
Stage 2:
Draw and animate with functions
• Learn to create functions, so you can make your own draw_tree commands • Learn to animate with functions and static variables (or skip this and use classes later. Static function variables are weird.) • Teach students about expressions and simple mathematics in Python.
Stage 3:
Learn to use loops
• Learn to loop • Learn nested loops (learn to use nested loops to draw grids, triangles, etc.) • Testing and unit tests
3.5. More Information 61 Arcade Documentation, Release 1.1.0
Stage 4:
Lists
• Working with lists • Creating lists from scratch • Keeping locations of items in a list (drawing stars or falling snow) • Array-backed grids (This can be pushed back in the curriculum easily)
Stage 5:
Object-oriented programming
• Object-oriented programming • User control of items • Sprites
Stage 6:
Other topics
Do these in any order: • Physics engines • Files • Code libraries • Searching • Sorting • Recursion • String formatting • Decorators
62 Chapter 3. Contribute to the development: CHAPTER 4
License
Copyright (c) 2016 Paul Vincent Craven The Arcade library is licensed under the MIT License. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen- tation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR- TICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT- WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63